summaryrefslogtreecommitdiff
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 20:35:37 +0200
commit82b9fe2cf41e93dd9d45383c08ea6e4fb934d35d (patch)
tree8b77cbfd610d78fa8f831f5069854217f8b9903a
parent467845e9a0cfc451ff24d6363babb87329d38406 (diff)
downloadsamba-82b9fe2cf41e93dd9d45383c08ea6e4fb934d35d.tar.gz
pidl/NDR/Parser: simplify logic in DeclareArrayVariables*()
metze (cherry picked from commit 102e9956316bbbbac2b440bb75eb039b184a2886)
-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 ccf9af97f35..31250014c39 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1512,11 +1512,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};");
}
}
@@ -1525,15 +1524,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};");
- }
}
}
}