svn commit: samba r20834 - in branches/SAMBA_4_0: . source/pidl/lib/Parse/Pidl source/pidl/lib/Parse/Pidl/Samba3

jelmer at samba.org jelmer at samba.org
Tue Jan 16 15:51:38 GMT 2007


Author: jelmer
Date: 2007-01-16 15:51:37 +0000 (Tue, 16 Jan 2007)
New Revision: 20834

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20834

Log:
No longer generate extra pointers for top-level [out] unique pointers.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:merge
   - jelmer at samba.org-20060824212938-5923465160f6ab63
jelmer at samba.org-20060830112659-186f132eebc987cc
jelmer at samba.org-20060904121718-63b73248146c14f8
jelmer at samba.org-20060904124721-5e70ab0bd405f748
metze at samba.org-20061010151401-45a5a2ed52cfe172
jelmer at samba.org-20061016130323-400ce51ee51ab30e
jelmer at samba.org-20061016195822-c7783d3ea1a56a53
jelmer at samba.org-20061016230421-75bca2ad62945ede
jelmer at samba.org-20061017145110-8c83a3dd979f6a6a
jelmer at samba.org-20061029173623-eb0459f1d3eb5720
jelmer at samba.org-20070115022006-h5ef1deqflt940b6
jelmer at samba.org-20070116142934-hv99dpwbnq2znh8f
jelmer at samba.org-20070116144126-70rip3bppmvgs3t6
jelmer at samba.org-20070116151516-imvui4r33cj850j9

   + jelmer at samba.org-20060824212938-5923465160f6ab63
jelmer at samba.org-20060830112659-186f132eebc987cc
jelmer at samba.org-20060904121718-63b73248146c14f8
jelmer at samba.org-20060904124721-5e70ab0bd405f748
metze at samba.org-20061010151401-45a5a2ed52cfe172
jelmer at samba.org-20061016130323-400ce51ee51ab30e
jelmer at samba.org-20061016195822-c7783d3ea1a56a53
jelmer at samba.org-20061016230421-75bca2ad62945ede
jelmer at samba.org-20061017145110-8c83a3dd979f6a6a
jelmer at samba.org-20061029173623-eb0459f1d3eb5720
jelmer at samba.org-20070115022006-h5ef1deqflt940b6
jelmer at samba.org-20070116142934-hv99dpwbnq2znh8f
jelmer at samba.org-20070116144126-70rip3bppmvgs3t6
jelmer at samba.org-20070116151516-imvui4r33cj850j9
jelmer at samba.org-20070116154739-3tji4fft7964qgrj


Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm	2007-01-16 15:50:25 UTC (rev 20833)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm	2007-01-16 15:51:37 UTC (rev 20834)
@@ -11,7 +11,7 @@
 use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
 use Parse::Pidl::Util qw(has_property is_constant);
 use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-use Parse::Pidl::Samba4 qw(DeclLong_cli IsUniqueOut);
+use Parse::Pidl::Samba4 qw(DeclLong);
 
 use vars qw($VERSION);
 $VERSION = '0.01';
@@ -35,7 +35,7 @@
 	my $ufn = "DCERPC_".uc($fn->{NAME});
 
 	foreach (@{$fn->{ELEMENTS}}) {
-		$defargs .= ", " . DeclLong_cli($_);
+		$defargs .= ", " . DeclLong($_);
 	}
 	fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
 	pidl "{";
@@ -47,12 +47,7 @@
 
 	foreach (@{$fn->{ELEMENTS}}) {
 		if (grep(/in/, @{$_->{DIRECTION}})) {
-		    if ( IsUniqueOut($_) ) {
-			pidl "r.in.$_->{NAME} = *$_->{NAME};";
-		    }
-		    else {
 			pidl "r.in.$_->{NAME} = $_->{NAME};";
-		    }
 		} 
 	}
 
@@ -83,8 +78,12 @@
 
 		fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
 
-		if ( IsUniqueOut($e) ) {
-			pidl "*$e->{NAME} = r.out.$e->{NAME};";
+		if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") && ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique") ) {
+			pidl "if ( $e->{NAME} ) {";
+			indent;
+			pidl "*$e->{NAME} = *r.out.$e->{NAME};";
+			deindent;
+			pidl "}";
 		} else {
 			pidl "*$e->{NAME} = *r.out.$e->{NAME};";
 		}

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm	2007-01-16 15:50:25 UTC (rev 20833)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm	2007-01-16 15:51:37 UTC (rev 20834)
@@ -7,7 +7,7 @@
 
 require Exporter;
 @ISA = qw(Exporter);
- at EXPORT = qw(is_intree choose_header DeclLong DeclLong_cli IsUniqueOut);
+ at EXPORT = qw(is_intree choose_header DeclLong);
 
 use Parse::Pidl::Util qw(has_property is_constant);
 use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
@@ -32,19 +32,9 @@
 	return "#include <$out>";
 }
 
-sub IsUniqueOut($)
+sub DeclLong($)
 {
-    my ($e) = shift;
-
-    return grep(/out/, @{$e->{DIRECTION}}) &&
-	((($e->{LEVELS}[0]->{TYPE} eq "POINTER") &&
-	  ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique")) ||
-	 ($e->{LEVELS}[0]->{TYPE} eq "ARRAY"));
-}
-
-sub DeclLong_int($$)
-{
-	my($element,$cli) = @_;
+	my($element) = shift;
 	my $ret = "";
 
 	if (has_property($element, "represent_as")) {
@@ -67,9 +57,6 @@
 				not has_property($element, "charset");
 			$numstar++;
 		}
-		if ($cli && IsUniqueOut($element)) {
-			$numstar++;
-		}
 		$ret.="*" foreach (1..$numstar);
 	}
 	$ret.=$element->{NAME};
@@ -81,14 +68,4 @@
 	return $ret;
 }
 
-sub DeclLong($)
-{
-    return DeclLong_int($_, 0);
-}
-
-sub DeclLong_cli($)
-{
-    return DeclLong_int($_, 1);
-}
-
 1;



More information about the samba-cvs mailing list