r24524: make use of ElementStars()
authorStefan Metzmacher <metze@samba.org>
Fri, 17 Aug 2007 13:53:12 +0000 (13:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:02:10 +0000 (15:02 -0500)
metze
(This used to be commit 701aa31d14cde412c1fecef694d851882be8d17f)

source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm

index a8e7c347b34759d71362b3802f3ad5cc6049d2b9..071163c3004e86dd00e4b457234d33662f2166d4 100644 (file)
@@ -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($$$$)