summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4.pm
diff options
context:
space:
mode:
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}]";
}