summaryrefslogtreecommitdiff
path: root/pidl/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-03-15 13:12:04 +0100
committerKarolin Seeger <kseeger@samba.org>2012-04-10 16:48:07 +0200
commit2de81df668e1b880d5c29c1115250ccf0e4ed617 (patch)
tree6809ffdae6784790be02f214300fd5437da72660 /pidl/lib
parentaad9449e56b8bef658821b7cab7baf9e327ce0c2 (diff)
downloadsamba-2de81df668e1b880d5c29c1115250ccf0e4ed617.tar.gz
samba-2de81df668e1b880d5c29c1115250ccf0e4ed617.tar.bz2
samba-2de81df668e1b880d5c29c1115250ccf0e4ed617.zip
pidl/NDR/Parser: simplify logic in DeclareArrayVariables*()
metze
Diffstat (limited to 'pidl/lib')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index d8cf974957..709ad2a0de 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1583,11 +1583,10 @@ sub DeclareArrayVariables($$)
my ($self,$e) = @_;
foreach my $l (@{$e->{LEVELS}}) {
+ next if ($l->{TYPE} ne "ARRAY");
next if has_fast_array($e,$l);
next if is_charset_array($e,$l);
- if ($l->{TYPE} eq "ARRAY") {
- $self->pidl("uint32_t cntr_$e->{NAME}_$l->{LEVEL_INDEX};");
- }
+ $self->pidl("uint32_t cntr_$e->{NAME}_$l->{LEVEL_INDEX};");
}
}
@@ -1596,15 +1595,14 @@ sub DeclareArrayVariablesNoZero($$$)
my ($self,$e,$env) = @_;
foreach my $l (@{$e->{LEVELS}}) {
+ next if ($l->{TYPE} ne "ARRAY");
next if has_fast_array($e,$l);
next if is_charset_array($e,$l);
- if ($l->{TYPE} eq "ARRAY") {
- my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
- if ($length eq "0") {
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
+ if ($length eq "0") {
warning($e->{ORIGINAL}, "pointless array cntr: 'cntr_$e->{NAME}_$l->{LEVEL_INDEX}': length=$length");
- } else {
+ } else {
$self->pidl("uint32_t cntr_$e->{NAME}_$l->{LEVEL_INDEX};");
- }
}
}
}