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.
This commit is contained in:
antirez 2017-01-18 17:11:57 +01:00
parent 53b8bf2c89
commit 17ac46ea78

View File

@ -41,7 +41,9 @@
#include <unistd.h> /* for _exit() */ #include <unistd.h> /* for _exit() */
#define assert(_e) ((_e)?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1))) #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 _serverAssert(char *estr, char *file, int line);
void _serverPanic(const char *file, int line, const char *msg, ...);
#endif #endif