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-07 16:26:03 +0200
commit102e9956316bbbbac2b440bb75eb039b184a2886 (patch)
treeadec9743d5a94aaeaed6de7fe6087f285a008082
parent45245f10c3bd476bcb49be25bc56bb7811b85d3c (diff)
downloadsamba-102e9956316bbbbac2b440bb75eb039b184a2886.tar.gz
pidl/NDR/Parser: simplify logic in DeclareArrayVariables*()
metze
-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};");
- }
}
}
}