summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-10-05 19:53:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:25 -0500
commit765f69ce42068cc2a41e010d08922a496da96054 (patch)
tree91c98495ae972ab5ae1de590ced804be1bc35a1b /source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
parentf72dee9e3908fb5c4ea3428e3cba703509a7e16f (diff)
downloadsamba-765f69ce42068cc2a41e010d08922a496da96054.tar.gz
samba-765f69ce42068cc2a41e010d08922a496da96054.tar.bz2
samba-765f69ce42068cc2a41e010d08922a496da96054.zip
r10739: Reduce number of calls to prs_align_custom()
(This used to be commit ebeeec5406308d493d45b1088963a87cdb953cac)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
index b65ece5a12..ac7fde69a6 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
@@ -71,14 +71,7 @@ sub ParseElementLevelData($$$$$$$)
{
my ($e,$l,$nl,$env,$varname,$what,$align) = @_;
- my @args = ($e,$l,$varname,$what);
-
- if (defined($e->{ALIGN})) {
- Align($align, $e->{ALIGN});
- } else {
- # Default to 4
- Align($align, 4);
- }
+ my @args = ($e,$l,$varname,$what,$align);
# See if we need to add a level argument because we're parsing a union
foreach (@{$e->{LEVELS}}) {
@@ -89,6 +82,13 @@ sub ParseElementLevelData($$$$$$$)
my $c = DissectType(@args);
return if not $c;
+ if (defined($e->{ALIGN})) {
+ Align($align, $e->{ALIGN});
+ } else {
+ # Default to 4
+ Align($align, 4);
+ }
+
pidl "if (!$c)";
pidl "\treturn False;";
}
@@ -300,13 +300,15 @@ sub ParseStruct($$$)
pidl "prs_debug(ps, depth, desc, \"$pfn\");";
pidl "depth++;";
+ my $align = 8;
if ($s->{SURROUNDING_ELEMENT}) {
pidl "if (!prs_uint32(\"size_$s->{SURROUNDING_ELEMENT}->{NAME}\", ps, depth, &" . ParseExpr("size_$s->{SURROUNDING_ELEMENT}->{NAME}", $env) . "))";
pidl "\treturn False;";
pidl "";
+ $align = 4;
+
}
- my $align = 0;
foreach (@{$s->{ELEMENTS}}) {
ParseElement($_, $env, PRIMITIVES, \$align);
pidl "";
@@ -393,7 +395,7 @@ sub ParseUnion($$$)
if ($_->{TYPE} ne "EMPTY") {
pidl "depth++;";
my $env = UnionGenerateEnvElement($_);
- my $align = 0;
+ my $align = 8;
ParseElement($_, $env, PRIMITIVES, \$align);
pidl "depth--;";
}