From 2e8b3926c69ee1d98a8958a8548ec2007ff2a3fb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 12 Oct 2004 10:32:54 +0000 Subject: r2933: Only pull a union once when it occurs in a subcontext (This used to be commit 309623447eef9ae554e2f25713c2123ab578cc6e) --- source4/build/pidl/parser.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source4/build') diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index 621b12aa62..edecc24284 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -454,7 +454,9 @@ sub ParseElementPullSwitch($$$$) my $sub_size = util::has_property($e, "subcontext"); if (defined $sub_size) { - pidl "\tNDR_CHECK(ndr_pull_subcontext_union_fn(ndr, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_pull_union_fn_t) ndr_pull_$e->{TYPE}));\n"; + pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n"; + pidl "\t\tNDR_CHECK(ndr_pull_subcontext_union_fn(ndr, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_pull_union_fn_t) ndr_pull_$e->{TYPE}));\n"; + pidl "\t}\n"; } else { pidl "\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $ndr_flags, $switch_var, $cprefix$var_prefix$e->{NAME}));\n"; } @@ -484,7 +486,9 @@ sub ParseElementPushSwitch($$$$) my $sub_size = util::has_property($e, "subcontext"); if (defined $sub_size) { - pidl "\tNDR_CHECK(ndr_push_subcontext_union_fn(ndr, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_push_union_fn_t) ndr_push_$e->{TYPE}));\n"; + pidl "\tif(($ndr_flags) & NDR_SCALARS) {\n"; + pidl "\t\tNDR_CHECK(ndr_push_subcontext_union_fn(ndr, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_push_union_fn_t) ndr_push_$e->{TYPE}));\n"; + pidl "\t}\n"; } else { pidl "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $ndr_flags, $switch_var, $cprefix$var_prefix$e->{NAME}));\n"; } -- cgit