Add MXS_ABORT_IF_FALSE

This commit is contained in:
Johan Wikman
2016-08-17 15:08:08 +03:00
parent ec08f1b276
commit d34e2da62e

View File

@ -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. * @brief Abort the process if the provided value is non-zero.
* *
* To be used in circumstances where a memory allocation failure * To be used in circumstances where a memory allocation or other
* cannot - currently - be dealt with properly. * fatal error cannot - currently - be dealt with properly.
*/ */
#define MXS_ABORT_IF_TRUE(b) do { if (b) { abort(); } } while (false) #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 EXTERN_C_BLOCK_END
#endif #endif