summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>2010-02-12 01:47:55 +0200
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2010-02-24 14:14:07 +0200
commite5aae24b3fef0048a33a682989935776f3415dc6 (patch)
tree877c0a71e08753dc765ea3492494dd8517f3dd1d
parent99db858b155a9a12bcbaae631d34d12062206e12 (diff)
downloadsamba-e5aae24b3fef0048a33a682989935776f3415dc6.tar.gz
samba-e5aae24b3fef0048a33a682989935776f3415dc6.tar.bz2
samba-e5aae24b3fef0048a33a682989935776f3415dc6.zip
s4/net_drs: Utility macros for conditions checking
-rw-r--r--source4/utils/net/drs/net_drs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/utils/net/drs/net_drs.h b/source4/utils/net/drs/net_drs.h
index 5bca47d2c2..4aeeb6fa4f 100644
--- a/source4/utils/net/drs/net_drs.h
+++ b/source4/utils/net/drs/net_drs.h
@@ -24,6 +24,26 @@
#include "librpc/gen_ndr/ndr_drsuapi_c.h"
+
+/**
+ * Check for critical error
+ */
+#define NET_DRS_CHECK_GOTO(_condition,_label,_msg) \
+ do { \
+ if (!(_condition)) { \
+ d_printf(__location__": "#_condition" - %s\n", _msg); \
+ goto _label; \
+ } \
+ } while (0)
+
+/**
+ * check allocated memory macro
+ */
+#define NET_DRS_NOMEM_GOTO(_ptr,_label) \
+ NET_DRS_CHECK_GOTO(_ptr, _label, "Not enough memory!")
+
+
+
/* net drs commands context */
struct net_drs_context {
struct net_context *net_ctx;