diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-27 19:13:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:51 -0500 |
commit | d49f11df218699014af32d19eef8dcc0a70ff38f (patch) | |
tree | c6ec4537b6b4205850fbb59b36540f4a4ca84e68 /source4/pidl/lib | |
parent | 00ace36e07f128df4596cfc8b6743fbfda2252bd (diff) | |
download | samba-d49f11df218699014af32d19eef8dcc0a70ff38f.tar.gz samba-d49f11df218699014af32d19eef8dcc0a70ff38f.tar.bz2 samba-d49f11df218699014af32d19eef8dcc0a70ff38f.zip |
r12517: Don't generate empty init functions
(This used to be commit 832a1092c9c11c293b5748e2e78da872fcba2a42)
Diffstat (limited to 'source4/pidl/lib')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 2247fcbf81..f294fa1b9b 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2158,13 +2158,10 @@ sub FunctionTable($) my $count = 0; my $uname = uc $interface->{NAME}; - $count = $#{$interface->{FUNCTIONS}}+1; - - return if ($count == 0); + return if ($#{$interface->{FUNCTIONS}}+1 == 0); return unless defined ($interface->{PROPERTIES}->{uuid}); pidl "static const struct dcerpc_interface_call $interface->{NAME}\_calls[] = {"; - $count = 0; foreach my $d (@{$interface->{FUNCTIONS}}) { next if not defined($d->{OPNUM}); pidl "\t{"; @@ -2343,26 +2340,26 @@ sub RegistrationFunction($$) { my ($idl,$basename) = @_; - pidl "NTSTATUS dcerpc_$basename\_init(void)"; - pidl "{"; - indent; - pidl "NTSTATUS status = NT_STATUS_OK;"; + my $body = ""; + foreach my $interface (@{$idl}) { next if $interface->{TYPE} ne "INTERFACE"; - - my $count = ($#{$interface->{FUNCTIONS}}+1); - - next if ($count == 0); + next if ($#{$interface->{FUNCTIONS}}+1 == 0); next unless defined ($interface->{PROPERTIES}->{uuid}); - pidl "status = dcerpc_ndr_$interface->{NAME}_init();"; - pidl "if (NT_STATUS_IS_ERR(status)) {"; - pidl "\treturn status;"; - pidl "}"; - pidl ""; + $body .= "\tstatus = dcerpc_ndr_$interface->{NAME}_init();\n"; + $body .= "\tif (NT_STATUS_IS_ERR(status)) {\n"; + $body .= "\t\treturn status;\n"; + $body .= "\t}\n"; + $body .= "\n"; } - pidl "return status;"; - deindent; + + return unless $body; + + pidl "NTSTATUS dcerpc_$basename\_init(void)"; + pidl "{"; + pidl "\tNTSTATUS status = NT_STATUS_OK;"; + pidl "$body\treturn status;"; pidl "}"; pidl ""; } |