summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authormetze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818>2007-11-01 10:13:36 +0000
committerStefan Metzmacher <metze@samba.org>2007-11-07 12:10:30 +0100
commitac8cf500d4485db26e8e611432aa74ce6ab7cfa6 (patch)
tree8540db54610107cc5b0dc8f57ae84ae064d6a42e /source3/librpc
parente04b21f7d4ac5e8940d38d231c46064152cdbf7f (diff)
downloadsamba-ac8cf500d4485db26e8e611432aa74ce6ab7cfa6.tar.gz
samba-ac8cf500d4485db26e8e611432aa74ce6ab7cfa6.tar.bz2
samba-ac8cf500d4485db26e8e611432aa74ce6ab7cfa6.zip
use NT_STATUS_HAVE_NO_MEMORY() and NDR_CHECK() macros
metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25778 0c0555d6-39d7-0310-84fc-f1cc0bd64818 (This used to be commit b542eaf825aa42b53f08c73e2b86ee9fafb33256)
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/ndr/ndr.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c
index 26bda33723..16a1cd6ed4 100644
--- a/source3/librpc/ndr/ndr.c
+++ b/source3/librpc/ndr/ndr.c
@@ -691,10 +691,9 @@ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *
{
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;
}
/*
@@ -704,14 +703,9 @@ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, vo
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]",
@@ -728,11 +722,10 @@ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p
{
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;
}
/*
@@ -743,15 +736,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]",