diff options
author | metze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818> | 2007-11-02 10:26:49 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-11-07 12:11:32 +0100 |
commit | ff595ad9c86076f19e0aa188de257ec4d54e31bd (patch) | |
tree | 7fdf93da3de60f64e0194da2d5a346abd7cf03a1 /source3/librpc/ndr | |
parent | 0f904f7d2ab374ea00623e739a145eb620d17283 (diff) | |
download | samba-ff595ad9c86076f19e0aa188de257ec4d54e31bd.tar.gz samba-ff595ad9c86076f19e0aa188de257ec4d54e31bd.tar.bz2 samba-ff595ad9c86076f19e0aa188de257ec4d54e31bd.zip |
use NT_STATUS_HAVE_NO_MEMORY() and NDR_CHECK()
metze
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25792 0c0555d6-39d7-0310-84fc-f1cc0bd64818
(This used to be commit f3dde8c7b73b619a54814bc6a862fa917455b624)
Diffstat (limited to 'source3/librpc/ndr')
-rw-r--r-- | source3/librpc/ndr/ndr.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c index 64706670fc..184a17d8f4 100644 --- a/source3/librpc/ndr/ndr.c +++ b/source3/librpc/ndr/ndr.c @@ -754,16 +754,11 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem 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); @@ -778,17 +773,12 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void * 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); |