summaryrefslogtreecommitdiff
path: root/source4/include
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-12-30 23:51:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:47 -0500
commit2c34148db5ff1d5cdf7dd7d2248974a85f628c17 (patch)
treef35d9446da42000dfc1061d1c41cc9a7990cb98e /source4/include
parentb5b1c52a9850de18e756cdd073cf5f44f26882fe (diff)
downloadsamba-2c34148db5ff1d5cdf7dd7d2248974a85f628c17.tar.gz
samba-2c34148db5ff1d5cdf7dd7d2248974a85f628c17.tar.bz2
samba-2c34148db5ff1d5cdf7dd7d2248974a85f628c17.zip
r4420: - add usefull helper macros for allocation failures,
they should be used in mostly all our code after calling a talloc_* function - the current NTSTATUS_TALLOC_CHECK() and WERR_TALLOC_CHECK() should be replaced by this new macros metze (This used to be commit b6376590f4b2409b2237809d378d9425fe1ce07e)
Diffstat (limited to 'source4/include')
-rw-r--r--source4/include/nt_status.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/include/nt_status.h b/source4/include/nt_status.h
index 4e61d9a365..e95e1a745c 100644
--- a/source4/include/nt_status.h
+++ b/source4/include/nt_status.h
@@ -57,9 +57,22 @@ typedef uint32_t WERROR;
#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
#define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y))
+
+#define NT_STATUS_HAVE_NO_MOMORY(x) do { \
+ if (!(x)) {\
+ return NT_STATUS_NO_MEMORY;\
+ }\
+} while (0)
+
#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0)
#define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y))
+#define W_ERROR_HAVE_NO_MOMORY(x) do { \
+ if (!(x)) {\
+ return WERR_NOMEM;\
+ }\
+} while (0)
+
/* this defines special NTSTATUS codes to represent DOS errors. I
have chosen this macro to produce status codes in the invalid
NTSTATUS range */