summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-01-18 17:11:57 +0100
committerantirez <antirez@gmail.com>2017-01-18 17:12:07 +0100
commit17ac46ea78fc3bed81b764d096ec8fb38e3ae3c9 (patch)
treee49856dcdc2906a71aa4d5190bbb607b7c53c7ad
parent53b8bf2c89ac9607a8bede2868d60cf8b3cbddd6 (diff)
downloadredis-17ac46ea78fc3bed81b764d096ec8fb38e3ae3c9.tar.gz
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.
-rw-r--r--src/redisassert.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/redisassert.h b/src/redisassert.h
index 34e95268a..c9b78327c 100644
--- a/src/redisassert.h
+++ b/src/redisassert.h
@@ -41,7 +41,9 @@
#include <unistd.h> /* 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