diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-11-01 10:13:36 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:43:55 +0100 |
commit | d933f396e849e78849e6b16fb0b6b7f5b1f12a02 (patch) | |
tree | 5383cd94072e767b24e60864749e7ec83f0f1c75 /source4/librpc/ndr | |
parent | 5885662475ab8baa1732a88a4bec0f1361edc4fb (diff) | |
download | samba-d933f396e849e78849e6b16fb0b6b7f5b1f12a02.tar.gz samba-d933f396e849e78849e6b16fb0b6b7f5b1f12a02.tar.bz2 samba-d933f396e849e78849e6b16fb0b6b7f5b1f12a02.zip |
r25778: use NT_STATUS_HAVE_NO_MEMORY() and NDR_CHECK() macros
metze
(This used to be commit 99dc12079762ab5b8ceea989cc8fa48ccf084863)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index f12be783b1..f3f941f0e0 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -728,10 +728,9 @@ _PUBLIC_ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ct { struct ndr_pull *ndr; ndr = ndr_pull_init_blob(blob, mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } - return fn(ndr, NDR_SCALARS|NDR_BUFFERS, p); + NT_STATUS_HAVE_NO_MEMORY(ndr); + NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); + return NT_STATUS_OK; } /* @@ -741,14 +740,9 @@ _PUBLIC_ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *me ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - NTSTATUS status; - ndr = ndr_pull_init_blob(blob, 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)); if (ndr->offset < ndr->data_size) { return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", @@ -765,11 +759,10 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx { struct ndr_pull *ndr; ndr = ndr_pull_init_blob(blob, mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } + NT_STATUS_HAVE_NO_MEMORY(ndr); ndr_pull_set_switch_value(ndr, p, level); - return fn(ndr, NDR_SCALARS|NDR_BUFFERS, p); + NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); + return NT_STATUS_OK; } /* @@ -780,15 +773,10 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - NTSTATUS status; - ndr = ndr_pull_init_blob(blob, mem_ctx); - if (!ndr) { - return NT_STATUS_NO_MEMORY; - } + NT_STATUS_HAVE_NO_MEMORY(ndr); ndr_pull_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)); if (ndr->offset < ndr->data_size) { return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", |