From 75564a9d0ece0c050923339b09457bc3dd1a5f5d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 17 Aug 2007 13:53:12 +0000 Subject: r24524: make use of ElementStars() metze (This used to be commit 701aa31d14cde412c1fecef694d851882be8d17f) --- source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 32 +++++++------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl/Samba3') diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index a8e7c347b3..071163c300 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -11,7 +11,7 @@ use Parse::Pidl qw(warning fatal); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); use Parse::Pidl::Util qw(ParseExpr has_property is_constant); use Parse::Pidl::NDR qw(GetNextLevel); -use Parse::Pidl::Samba4 qw(DeclLong); +use Parse::Pidl::Samba4 qw(ElementStars DeclLong); use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv); use vars qw($VERSION); @@ -28,36 +28,20 @@ sub fn_declare($) { my ($n) = @_; pidl $n; pidl_hdr "$n;"; } sub DeclLevel($$) { - sub DeclLevel($$); my ($e, $l) = @_; - - my $ret = ""; + my $res = ""; if (has_property($e, "charset")) { - $ret.="const char"; + $res .= "const char"; } else { - $ret.=mapTypeName($e->{TYPE}); + $res .= mapTypeName($e->{TYPE}); } - my $numstar = $e->{ORIGINAL}->{POINTERS}; - if ($numstar >= 1) { - $numstar-- if scalar_is_reference($e->{TYPE}); - } - foreach (@{$e->{ORIGINAL}->{ARRAY_LEN}}) - { - next if is_constant($_) and - not has_property($e, "charset"); - $numstar++; - } - $numstar -= $l; - die ("Too few pointers") if $numstar < 0; - if ($numstar > 0) - { - $ret.=" "; - $ret.="*" foreach (1..$numstar); - } + my $stars = ElementStars($e, $l); + + $res .= " ".$stars unless ($stars eq ""); - return $ret; + return $res; } sub AllocOutVar($$$$) -- cgit