summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/NDR.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/NDR.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/NDR.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm26
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 5839b042d3..21875a1297 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -571,8 +571,7 @@ sub ParseFunction($$$)
sub CheckPointerTypes($$)
{
- my $s = shift;
- my $default = shift;
+ my ($s,$default) = @_;
foreach my $e (@{$s->{ELEMENTS}}) {
if ($e->{POINTERS} and not defined(pointer_type($e))) {
@@ -581,6 +580,23 @@ 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;
@@ -606,10 +622,12 @@ 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));
}
}
@@ -831,6 +849,10 @@ 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"],
);
#####################################################################