From cd9057a0bb90bef6d31051f176849b6a3543a376 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 18 Sep 2006 21:52:00 +0000 Subject: r18639: Get rid of the keepref support (This used to be commit d1364ef0cd8f1a64f44476476323ab390ac4de48) --- source4/pidl/lib/Parse/Pidl/NDR.pm | 23 ------------- source4/pidl/lib/Parse/Pidl/Samba4/Header.pm | 6 +--- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 42 +++++++++--------------- 3 files changed, 16 insertions(+), 55 deletions(-) (limited to 'source4/pidl/lib') diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm index f602bd2d68..cd8aa214ff 100644 --- a/source4/pidl/lib/Parse/Pidl/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/NDR.pm @@ -586,23 +586,6 @@ sub CheckPointerTypes($$) } } -#FIXME: Remove when ref handling in Samba4 is fixed -sub AddKeepRef($) -{ - my $d = shift; - - if ($d->{TYPE} eq "FUNCTION") { - foreach (@{$d->{ELEMENTS}}) { - $_->{PROPERTIES}->{keepref} = 1; - } - } elsif ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "STRUCT" - or $d->{DATA}->{TYPE} eq "UNION")) { - foreach (@{$d->{DATA}->{ELEMENTS}}) { - $_->{PROPERTIES}->{keepref} = 1; - } - } -} - sub ParseInterface($) { my $idl = shift; @@ -628,12 +611,10 @@ sub ParseInterface($) if ($d->{TYPE} eq "DECLARE") { push (@declares, $d); } elsif ($d->{TYPE} eq "FUNCTION") { - AddKeepRef($d) if (has_property($idl, "keepref")); push (@functions, ParseFunction($idl, $d, \$opnum)); } elsif ($d->{TYPE} eq "CONST") { push (@consts, ParseConst($idl, $d)); } else { - AddKeepRef($d) if (has_property($idl, "keepref")); push (@types, ParseType($idl, $d)); } } @@ -855,10 +836,6 @@ my %property_list = ( "noheader" => ["ELEMENT"], "charset" => ["ELEMENT"], "length_is" => ["ELEMENT"], - - # temporary (should be removed once we've migrated away from - # relying on ref pointers being there in Samba4's code) - "keepref" => ["ELEMENT","INTERFACE"], ); ##################################################################### diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm index c9487115f5..6fb3ee2eec 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -60,11 +60,7 @@ sub HeaderElement($) } else { HeaderType($element, $element->{TYPE}, ""); pidl " "; - my $numstar = 0; - if (!has_property($element, "ref") or - has_property($element, "keepref")) { - $numstar += $element->{POINTERS}; - } + my $numstar = $element->{POINTERS}; if ($numstar >= 1) { $numstar-- if Parse::Pidl::Typelist::scalar_is_reference($element->{TYPE}); } diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index bbcc9f884e..6124935e67 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -593,9 +593,7 @@ sub ParseElementPushLevel pidl "NDR_CHECK(ndr_push_relative_ptr2(ndr, $var_name));"; } } - if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) { - $var_name = get_value_of($var_name); - } + $var_name = get_value_of($var_name); ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1); if ($l->{POINTER_TYPE} ne "ref") { @@ -675,9 +673,7 @@ sub ParsePtrPush($$$) my ($e,$l,$var_name) = @_; if ($l->{POINTER_TYPE} eq "ref") { - if (has_property($e, "keepref")) { - check_null_pointer(get_value_of($var_name)); - } + check_null_pointer(get_value_of($var_name)); if ($l->{LEVEL} eq "EMBEDDED") { pidl "NDR_CHECK(ndr_push_ref_ptr(ndr));"; } @@ -713,15 +709,13 @@ sub ParseElementPrint($$$) foreach my $l (@{$e->{LEVELS}}) { if ($l->{TYPE} eq "POINTER") { - if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) { pidl "ndr_print_ptr(ndr, \"$e->{NAME}\", $var_name);"; pidl "ndr->depth++;"; - if ($l->{POINTER_TYPE} ne "ref") { - pidl "if ($var_name) {"; - indent; - } - $var_name = get_value_of($var_name); + if ($l->{POINTER_TYPE} ne "ref") { + pidl "if ($var_name) {"; + indent; } + $var_name = get_value_of($var_name); } elsif ($l->{TYPE} eq "ARRAY") { my $length; @@ -770,13 +764,11 @@ sub ParseElementPrint($$$) foreach my $l (reverse @{$e->{LEVELS}}) { if ($l->{TYPE} eq "POINTER") { - if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) { - if ($l->{POINTER_TYPE} ne "ref") { - deindent; - pidl "}"; - } - pidl "ndr->depth--;"; + if ($l->{POINTER_TYPE} ne "ref") { + deindent; + pidl "}"; } + pidl "ndr->depth--;"; } elsif (($l->{TYPE} eq "ARRAY") and not is_charset_array($e,$l) and not has_fast_array($e,$l)) { @@ -890,7 +882,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 or not has_property($e, "keepref")) { + if ($next_is_array or $next_is_string) { return; } else { $mem_c_flags = "LIBNDR_FLAG_REF_ALLOC"; @@ -916,7 +908,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 or not has_property($e, "keepref")) { + if ($next_is_array or $next_is_string) { return; } else { $mem_r_flags = "LIBNDR_FLAG_REF_ALLOC"; @@ -993,9 +985,7 @@ sub ParseElementPullLevel ParseMemCtxPullStart($e,$l, $var_name); - if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) { - $var_name = get_value_of($var_name); - } + $var_name = get_value_of($var_name); ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1); ParseMemCtxPullEnd($e,$l); @@ -1099,8 +1089,7 @@ sub ParsePtrPull($$$$) pidl "NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));"; } - if (!$next_is_array and !$next_is_string and - has_property($e, "keepref")) { + if (!$next_is_array and !$next_is_string) { pidl "if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {"; pidl "\tNDR_PULL_ALLOC($ndr, $var_name);"; pidl "}"; @@ -1445,7 +1434,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 or not has_property($e, "keepref")); + return 0 if ($next_is_array or $next_is_string); } return 1 if ($l->{TYPE} eq "POINTER"); @@ -2111,7 +2100,6 @@ 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") -- cgit