diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-11-02 10:26:49 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:44:01 +0100 |
commit | 520dcd4a878bd630b3e0aa5229b1de33cc6540e5 (patch) | |
tree | 1f1f7b0270cbd181e2f19d97a512bc9ca27be102 /source4 | |
parent | fdb369530baf334be9f6af2dff20d7119bf3cad3 (diff) | |
download | samba-520dcd4a878bd630b3e0aa5229b1de33cc6540e5.tar.gz samba-520dcd4a878bd630b3e0aa5229b1de33cc6540e5.tar.bz2 samba-520dcd4a878bd630b3e0aa5229b1de33cc6540e5.zip |
r25792: use NT_STATUS_HAVE_NO_MEMORY() and NDR_CHECK()
metze
(This used to be commit eebc17b27a6d6467546a1f070d5233f6c1755f47)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 787bbdc383..680ae9043e 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -791,16 +791,11 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem _PUBLIC_ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn) { - NTSTATUS status; struct ndr_push *ndr; ndr = ndr_push_init_ctx(mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } - status = fn(ndr, NDR_SCALARS|NDR_BUFFERS, p); - if (!NT_STATUS_IS_OK(status)) { - return status; - } + NT_STATUS_HAVE_NO_MEMORY(ndr); + + NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); *blob = ndr_push_blob(ndr); talloc_steal(mem_ctx, blob->data); @@ -815,17 +810,12 @@ _PUBLIC_ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, con _PUBLIC_ NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn) { - NTSTATUS status; struct ndr_push *ndr; ndr = ndr_push_init_ctx(mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } + NT_STATUS_HAVE_NO_MEMORY(ndr); + ndr_push_set_switch_value(ndr, p, level); - status = fn(ndr, NDR_SCALARS|NDR_BUFFERS, p); - if (!NT_STATUS_IS_OK(status)) { - return status; - } + NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); *blob = ndr_push_blob(ndr); talloc_steal(mem_ctx, blob->data); |