svn commit: samba r4420 - in branches/SAMBA_4_0/source/include: .

metze at samba.org metze at samba.org
Thu Dec 30 23:51:18 GMT 2004


Author: metze
Date: 2004-12-30 23:51:18 +0000 (Thu, 30 Dec 2004)
New Revision: 4420

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4420

Log:
- 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

Modified:
   branches/SAMBA_4_0/source/include/nt_status.h


Changeset:
Modified: branches/SAMBA_4_0/source/include/nt_status.h
===================================================================
--- branches/SAMBA_4_0/source/include/nt_status.h	2004-12-30 20:34:20 UTC (rev 4419)
+++ branches/SAMBA_4_0/source/include/nt_status.h	2004-12-30 23:51:18 UTC (rev 4420)
@@ -57,9 +57,22 @@
 #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 */



More information about the samba-cvs mailing list