mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
r20834: No longer generate extra pointers for top-level [out] unique pointers.
(This used to be commit b967f5851f
)
This commit is contained in:
parent
9119276bbc
commit
85520faa42
@ -11,7 +11,7 @@ use Parse::Pidl qw(fatal warning);
|
|||||||
use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
|
use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
|
||||||
use Parse::Pidl::Util qw(has_property is_constant);
|
use Parse::Pidl::Util qw(has_property is_constant);
|
||||||
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
|
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);
|
use vars qw($VERSION);
|
||||||
$VERSION = '0.01';
|
$VERSION = '0.01';
|
||||||
@ -35,7 +35,7 @@ sub ParseFunction($$)
|
|||||||
my $ufn = "DCERPC_".uc($fn->{NAME});
|
my $ufn = "DCERPC_".uc($fn->{NAME});
|
||||||
|
|
||||||
foreach (@{$fn->{ELEMENTS}}) {
|
foreach (@{$fn->{ELEMENTS}}) {
|
||||||
$defargs .= ", " . DeclLong_cli($_);
|
$defargs .= ", " . DeclLong($_);
|
||||||
}
|
}
|
||||||
fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
|
fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
|
||||||
pidl "{";
|
pidl "{";
|
||||||
@ -47,12 +47,7 @@ sub ParseFunction($$)
|
|||||||
|
|
||||||
foreach (@{$fn->{ELEMENTS}}) {
|
foreach (@{$fn->{ELEMENTS}}) {
|
||||||
if (grep(/in/, @{$_->{DIRECTION}})) {
|
if (grep(/in/, @{$_->{DIRECTION}})) {
|
||||||
if ( IsUniqueOut($_) ) {
|
|
||||||
pidl "r.in.$_->{NAME} = *$_->{NAME};";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pidl "r.in.$_->{NAME} = $_->{NAME};";
|
pidl "r.in.$_->{NAME} = $_->{NAME};";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +78,12 @@ sub ParseFunction($$)
|
|||||||
|
|
||||||
fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
|
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) ) {
|
if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") && ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique") ) {
|
||||||
pidl "*$e->{NAME} = r.out.$e->{NAME};";
|
pidl "if ( $e->{NAME} ) {";
|
||||||
|
indent;
|
||||||
|
pidl "*$e->{NAME} = *r.out.$e->{NAME};";
|
||||||
|
deindent;
|
||||||
|
pidl "}";
|
||||||
} else {
|
} else {
|
||||||
pidl "*$e->{NAME} = *r.out.$e->{NAME};";
|
pidl "*$e->{NAME} = *r.out.$e->{NAME};";
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ package Parse::Pidl::Samba4;
|
|||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
@ISA = qw(Exporter);
|
@ISA = qw(Exporter);
|
||||||
@EXPORT = qw(is_intree choose_header DeclLong DeclLong_cli IsUniqueOut);
|
@EXPORT = qw(is_intree choose_header DeclLong);
|
||||||
|
|
||||||
use Parse::Pidl::Util qw(has_property is_constant);
|
use Parse::Pidl::Util qw(has_property is_constant);
|
||||||
use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
|
use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
|
||||||
@ -32,19 +32,9 @@ sub choose_header($$)
|
|||||||
return "#include <$out>";
|
return "#include <$out>";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub IsUniqueOut($)
|
sub DeclLong($)
|
||||||
{
|
{
|
||||||
my ($e) = shift;
|
my($element) = 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 $ret = "";
|
my $ret = "";
|
||||||
|
|
||||||
if (has_property($element, "represent_as")) {
|
if (has_property($element, "represent_as")) {
|
||||||
@ -67,9 +57,6 @@ sub DeclLong_int($$)
|
|||||||
not has_property($element, "charset");
|
not has_property($element, "charset");
|
||||||
$numstar++;
|
$numstar++;
|
||||||
}
|
}
|
||||||
if ($cli && IsUniqueOut($element)) {
|
|
||||||
$numstar++;
|
|
||||||
}
|
|
||||||
$ret.="*" foreach (1..$numstar);
|
$ret.="*" foreach (1..$numstar);
|
||||||
}
|
}
|
||||||
$ret.=$element->{NAME};
|
$ret.=$element->{NAME};
|
||||||
@ -81,14 +68,4 @@ sub DeclLong_int($$)
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub DeclLong($)
|
|
||||||
{
|
|
||||||
return DeclLong_int($_, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub DeclLong_cli($)
|
|
||||||
{
|
|
||||||
return DeclLong_int($_, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user