From 17ac46ea78fc3bed81b764d096ec8fb38e3ae3c9 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 18 Jan 2017 17:11:57 +0100 Subject: [PATCH] Add panic() into redisassert.h. This header file is for libs, like ziplist.c, that we want to leave almost separted from the core. The panic() calls will be easy to delete in order to use such files outside, but the debugging info we gain are very valuable compared to simple assertions where it is not possible to print debugging info. --- src/redisassert.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/redisassert.h b/src/redisassert.h index 34e95268..c9b78327 100644 --- a/src/redisassert.h +++ b/src/redisassert.h @@ -41,7 +41,9 @@ #include /* for _exit() */ #define assert(_e) ((_e)?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1))) +#define panic(...) _serverPanic(__FILE__,__LINE__,__VA_ARGS__),_exit(1) void _serverAssert(char *estr, char *file, int line); +void _serverPanic(const char *file, int line, const char *msg, ...); #endif