r9124: Handle more types pointers to simple types.
authorTim Potter <tpot@samba.org>
Fri, 5 Aug 2005 15:54:11 +0000 (15:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:31:19 +0000 (13:31 -0500)
source/script/build_smb_interfaces.pl

index 7c9bd3d365331c798cc0be3057d0c48d6fe9907c..3aacc6df55ff07db84dd6565250a3c97abfbbfb4 100755 (executable)
@@ -77,7 +77,7 @@ sub print_field($$) {
   my $f = shift;
   my $suffix = shift;
 
-  my $type = "UNKNOWN";
+  my $type = $f->{TYPE};
 
   if ($f->{TYPE} eq "char" and $f->{POINTERS} == 1) {
     $type = "string";
@@ -88,8 +88,16 @@ sub print_field($$) {
     $type =~ s/_t$//;
   }
 
+  my $deref = "&";
+  if ($f->{POINTERS} == 1 && $type ne "string") {
+    $deref = "";
+  }
+
   foreach my $x (@{$f->{NAME}}) {
-    print FILE "\tNDR_CHECK(ejs_pull_$type(ejs, v, \"$x\", &r->$suffix.$x));\n";
+    if ($f->{POINTERS} > 0) {
+      print FILE "\t// alloc $x?\n";
+    }
+    print FILE "\tNDR_CHECK(ejs_pull_$type(ejs, v, \"$x\", ${deref}r->$suffix.$x));\n";
   }
 }