summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-12-16 11:41:20 +1100
committerAndrew Tridgell <tridge@samba.org>2008-12-16 11:41:20 +1100
commitf448fde4e35e56508ad93be8de9f60d88e8b8dcd (patch)
tree597b58ba1af03f5250af918ec15300c385281706 /pidl/lib/Parse/Pidl/Samba4.pm
parenta226d86dcec393b2cd657d5441c3041dfdf5cd8f (diff)
parent530758dc2a6dd6dce083789b328e16e51ba6573d (diff)
downloadsamba-f448fde4e35e56508ad93be8de9f60d88e8b8dcd.tar.gz
samba-f448fde4e35e56508ad93be8de9f60d88e8b8dcd.tar.bz2
samba-f448fde4e35e56508ad93be8de9f60d88e8b8dcd.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4.pm')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4.pm b/pidl/lib/Parse/Pidl/Samba4.pm
index d42e01cdb0..5bdb91ee25 100644
--- a/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/pidl/lib/Parse/Pidl/Samba4.pm
@@ -7,7 +7,7 @@ package Parse::Pidl::Samba4;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(is_intree choose_header NumStars ElementStars ArrayBrackets DeclLong);
+@EXPORT = qw(is_intree choose_header NumStars ElementStars ArrayBrackets DeclLong ArrayDynamicallyAllocated);
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
@@ -36,6 +36,14 @@ sub choose_header($$)
return "#include <$out>";
}
+sub ArrayDynamicallyAllocated($$)
+{
+ my ($e, $l) = @_;
+ die("Not an array") unless ($l->{TYPE} eq "ARRAY");
+ return 0 if ($l->{IS_FIXED} and not has_property($e, "charset"));
+ return 1;
+}
+
sub NumStars($;$)
{
my ($e, $d) = @_;
@@ -57,7 +65,7 @@ sub NumStars($;$)
foreach my $l (@{$e->{LEVELS}}) {
next unless ($l->{TYPE} eq "ARRAY");
- next if ($l->{IS_FIXED}) and not has_property($e, "charset");
+ next unless (ArrayDynamicallyAllocated($e, $l));
$n++;
}
@@ -87,7 +95,7 @@ sub ArrayBrackets($)
foreach my $l (@{$e->{LEVELS}}) {
next unless ($l->{TYPE} eq "ARRAY");
- next unless ($l->{IS_FIXED}) and not has_property($e, "charset");
+ next if ArrayDynamicallyAllocated($e, $l);
$res .= "[$l->{SIZE_IS}]";
}