summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-21 12:58:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:18 -0500
commit9727b061f330ba8f500a29bf4b94992e2bceffbc (patch)
treeecc3bcd73ce3efe84c78d62f763d4eb4dd944c85 /source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
parent39fd6db42b4186f573ab4728509d6b8a7c8a6973 (diff)
downloadsamba-9727b061f330ba8f500a29bf4b94992e2bceffbc.tar.gz
samba-9727b061f330ba8f500a29bf4b94992e2bceffbc.tar.bz2
samba-9727b061f330ba8f500a29bf4b94992e2bceffbc.zip
r15776: Don't generate ref pointers in Samba4-generated code. There is no point
in having pointers for outgoing data when you can already modify the top-level element. This can be overridden (temporarily) by specifying the new "keepref" attribute. Once we've removed keepref from all IDL files, I'll remove this attribute as well. (This used to be commit bdc6dd37503ced8322a671d225122ccffbb8bfec)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm30
1 files changed, 18 insertions, 12 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index b7ae526e68..5a8ef53e14 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -582,7 +582,9 @@ sub ParseElementPushLevel
pidl "NDR_CHECK(ndr_push_relative_ptr2(ndr, $var_name));";
}
}
- $var_name = get_value_of($var_name);
+ if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
+ $var_name = get_value_of($var_name);
+ }
ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1);
if ($l->{POINTER_TYPE} ne "ref") {
@@ -662,11 +664,12 @@ sub ParsePtrPush($$$)
my ($e,$l,$var_name) = @_;
if ($l->{POINTER_TYPE} eq "ref") {
- if ($l->{LEVEL} eq "EMBEDDED") {
- pidl "NDR_CHECK(ndr_push_ref_ptr(ndr, $var_name));";
- } else {
+ if (has_property($e, "keepref")) {
check_null_pointer(get_value_of($var_name));
}
+ if ($l->{LEVEL} eq "EMBEDDED") {
+ pidl "NDR_CHECK(ndr_push_ref_ptr(ndr));";
+ }
} elsif ($l->{POINTER_TYPE} eq "relative") {
pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_name));";
} elsif ($l->{POINTER_TYPE} eq "unique") {
@@ -872,7 +875,7 @@ sub ParseMemCtxPullStart($$$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- if ($next_is_array or $next_is_string) {
+ if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return;
} else {
$mem_c_flags = "LIBNDR_FLAG_REF_ALLOC";
@@ -898,7 +901,7 @@ sub ParseMemCtxPullEnd($$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- if ($next_is_array or $next_is_string) {
+ if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return;
} else {
$mem_r_flags = "LIBNDR_FLAG_REF_ALLOC";
@@ -975,7 +978,9 @@ sub ParseElementPullLevel
ParseMemCtxPullStart($e,$l, $var_name);
- $var_name = get_value_of($var_name);
+ if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
+ $var_name = get_value_of($var_name);
+ }
ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
ParseMemCtxPullEnd($e,$l);
@@ -1075,11 +1080,12 @@ sub ParsePtrPull($$$$)
($nl->{DATA_TYPE} eq "string"));
if ($l->{POINTER_TYPE} eq "ref") {
- unless ($l->{LEVEL} eq "TOP") {
+ if ($l->{LEVEL} eq "EMBEDDED") {
pidl "NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));";
}
- unless ($next_is_array or $next_is_string) {
+ if (!$next_is_array and !$next_is_string and
+ has_property($e, "keepref")) {
pidl "if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {";
pidl "\tNDR_PULL_ALLOC($ndr, $var_name);";
pidl "}";
@@ -1413,8 +1419,7 @@ sub DeclareArrayVariables($)
sub need_decl_mem_ctx($$)
{
- my $e = shift;
- my $l = shift;
+ my ($e,$l) = @_;
return 0 if has_fast_array($e,$l);
return 0 if is_charset_array($e,$l);
@@ -1425,7 +1430,7 @@ sub need_decl_mem_ctx($$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- return 0 if ($next_is_array or $next_is_string);
+ return 0 if ($next_is_array or $next_is_string or not has_property($e, "keepref"));
}
return 1 if ($l->{TYPE} eq "POINTER");
@@ -2091,6 +2096,7 @@ sub ParseFunctionPull($)
next unless (grep(/out/, @{$e->{DIRECTION}}));
next unless ($e->{LEVELS}[0]->{TYPE} eq "POINTER" and
$e->{LEVELS}[0]->{POINTER_TYPE} eq "ref");
+ next unless has_property($e, "keepref");
next if (($e->{LEVELS}[1]->{TYPE} eq "DATA") and
($e->{LEVELS}[1]->{DATA_TYPE} eq "string"));
next if (($e->{LEVELS}[1]->{TYPE} eq "ARRAY")