From d34e2da62ee6097804f9aa6bf6de0c201b9fae02 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 17 Aug 2016 15:08:08 +0300 Subject: [PATCH] Add MXS_ABORT_IF_FALSE --- server/include/maxscale/alloc.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/include/maxscale/alloc.h b/server/include/maxscale/alloc.h index 88a60bc0c..5a87268ef 100644 --- a/server/include/maxscale/alloc.h +++ b/server/include/maxscale/alloc.h @@ -64,11 +64,19 @@ char *mxs_strndup_a(const char *s, size_t n/*, const char *caller*/); /** * @brief Abort the process if the provided value is non-zero. * - * To be used in circumstances where a memory allocation failure - * cannot - currently - be dealt with properly. + * To be used in circumstances where a memory allocation or other + * fatal error cannot - currently - be dealt with properly. */ #define MXS_ABORT_IF_TRUE(b) do { if (b) { abort(); } } while (false) +/** + * @brief Abort the process if the provided value is zero. + * + * To be used in circumstances where a memory allocation or other + * fatal error cannot - currently - be dealt with properly. + */ +#define MXS_ABORT_IF_FALSE(b) do { if (!b) { abort(); } } while (false) + EXTERN_C_BLOCK_END #endif