summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-12 04:18:21 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-12 04:18:21 +0000
commit869df3adbd02f8a151e54c3216155163979b99fe (patch)
tree2d24454c1e7cf8db87e56e03b1b69217366058c4 /source4/build/pidl
parent16309de71d6c8de96e869aeaab0b879185991d87 (diff)
downloadsamba-869df3adbd02f8a151e54c3216155163979b99fe.tar.gz
samba-869df3adbd02f8a151e54c3216155163979b99fe.tar.bz2
samba-869df3adbd02f8a151e54c3216155163979b99fe.zip
handle the auto-allocation of [ref] output arrays in pidl. This
can simplify rpc servers a lot. (This used to be commit 28fa62d63d020052a0d2f467f3f9cc6344aaf0ce)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/parser.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 88ba348486..d7f3814abd 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -318,14 +318,14 @@ sub ParseArrayPull($$$)
if ((util::need_alloc($e) && !util::is_fixed_array($e)) ||
($var_prefix eq "r->in." && util::has_property($e, "ref"))) {
if (!util::is_inline_array($e) || $ndr_flags eq "NDR_SCALARS") {
- pidl "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size), sizeof($var_prefix$e->{NAME}\[0]));\n";
+ pidl "\t\tNDR_ALLOC_N(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size));\n";
}
}
if (($var_prefix eq "r->out." && util::has_property($e, "ref"))) {
if (!util::is_inline_array($e) || $ndr_flags eq "NDR_SCALARS") {
pidl "\tif (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {";
- pidl "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size), sizeof($var_prefix$e->{NAME}\[0]));\n";
+ pidl "\t\tNDR_ALLOC_N(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size));\n";
pidl "\t}\n";
}
}
@@ -1259,7 +1259,13 @@ sub ParseFunctionPull($)
# we need to allocate any reference output variables, so that
# a dcerpc backend can be sure they are non-null
if (util::has_property($e, "out") && util::has_property($e, "ref")) {
- pidl "\tNDR_ALLOC(ndr, r->out.$e->{NAME});\n";
+ my $asize = util::array_size($e);
+ if (defined $asize) {
+ my $size = find_size_var($e, $asize, "r->out.");
+ pidl "\tNDR_ALLOC_N(ndr, r->out.$e->{NAME}, MAX(1, $size));\n";
+ } else {
+ pidl "\tNDR_ALLOC(ndr, r->out.$e->{NAME});\n";
+ }
}
}