summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/common-utils.h')
-rw-r--r--libglusterfs/src/common-utils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 6e1669912cd..71ff9eab5de 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -166,6 +166,21 @@ int gf_set_log_ident (cmd_args_t *cmd_args);
} \
}while (0)
+#define GF_CHECK_ALLOC(arg, retval, label) do { \
+ if (!(arg)) { \
+ retval = -ENOMEM; \
+ goto label; \
+ } \
+ } while (0) \
+
+#define GF_CHECK_ALLOC_AND_LOG(name, item, retval, msg, errlabel) do { \
+ if (!(item)) { \
+ (retval) = -ENOMEM; \
+ gf_log (name, GF_LOG_CRITICAL, (msg)); \
+ goto errlabel; \
+ } \
+ } while (0)
+
#define GF_ASSERT_AND_GOTO_WITH_ERROR(name, arg, label, errno, error) do { \
if (!arg) { \
GF_ASSERT (0); \