]> err.no Git - varnish/commitdiff
Add our own assert in libvarnish.h
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Aug 2006 16:42:11 +0000 (16:42 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Aug 2006 16:42:11 +0000 (16:42 +0000)
Include libvarnish.h from cache.h and mgt.h

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@740 d4fa192b-c00b-0410-8231-f00ffab90ce4

20 files changed:
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_session.c
varnish-cache/bin/varnishd/hash_classic.c
varnish-cache/bin/varnishd/mgt.h
varnish-cache/bin/varnishd/mgt_child.c
varnish-cache/bin/varnishd/mgt_cli.c
varnish-cache/bin/varnishd/mgt_event.c
varnish-cache/bin/varnishd/mgt_vcc.c
varnish-cache/bin/varnishd/shmlog.c
varnish-cache/bin/varnishd/storage_file.c
varnish-cache/bin/varnishd/tcp.c
varnish-cache/bin/varnishd/varnishd.c
varnish-cache/bin/varnishlog/varnishlog.c
varnish-cache/bin/varnishncsa/varnishncsa.c
varnish-cache/bin/varnishtester/varnishtester.c
varnish-cache/bin/varnishtop/varnishtop.c
varnish-cache/include/libvarnish.h
varnish-cache/lib/libvarnish/Makefile.am
varnish-cache/lib/libvarnish/argv.c
varnish-cache/lib/libvarnish/assert.c [new file with mode: 0644]

index ff875c539d5dcc30573d63271c04578838895d5c..1558f374cd81235bb0d6b8f7c258c06ed23f5e80 100644 (file)
@@ -5,13 +5,14 @@
 #include <sys/time.h>
 #include <sys/uio.h>
 
-#include <assert.h>
 #include <pthread.h>
 #include <stdint.h>
 
 #include "queue.h"
 #include "vsb.h"
 
+#include "libvarnish.h"
+
 #include "vcl_returns.h"
 #include "common.h"
 #include "miniobj.h"
index c38dcf2ef292a57327fe15888899879b964e1829..abe36f136045b9d15a982d78cafff1ab99c8f7fe 100644 (file)
@@ -17,7 +17,6 @@
 #include <sys/uio.h>
 #include <sys/socket.h>
 
-#include "libvarnish.h"
 #include "heritage.h"
 #include "shmlog.h"
 #include "cache.h"
index 33df6106471ae6f64bab1b3fdd7121bec3bd479d..d300d265e7c258b565a045a066733ab6e8f25ea4 100644 (file)
@@ -10,7 +10,6 @@
 #include <sys/types.h>
 #include <md5.h>
 
-#include <libvarnish.h>
 #include <cache.h>
 
 /*--------------------------------------------------------------------*/
index 807fe4552a735b9dc8ea6fa83f1973292a4cdd76..78ecb50128894014b147ced55594149d4814f2e3 100644 (file)
@@ -5,6 +5,8 @@
 #include "common.h"
 #include "miniobj.h"
 
+#include "libvarnish.h"
+
 extern struct evbase   *mgt_evb;
 
 /* mgt_child.c */
index 2b2c3db3f8b4326be72a84f69a2e24dd25a82b47..c0650e82f6deec8b65625ea750a228a33b0de245 100644 (file)
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <signal.h>
-#include <assert.h>
 #include <errno.h>
 #include <poll.h>
 #include <sys/types.h>
@@ -18,7 +17,6 @@
 
 #include <err.h>               /* XXX */
 
-#include "libvarnish.h"
 #include "heritage.h"
 #include "mgt.h"
 #include "cli.h"
index 358480bc26a2d509777304a90a97b00d7f49fc2c..7eb423bd9f636902446673bd870e4dec8cf2f036 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <sys/types.h>
 
-#include <assert.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
index 25dd6b75b1590430dfa80ba558315bc6855fe8eb..04f22cf0fe452e22485a73f7f228e60524988767 100644 (file)
@@ -3,7 +3,6 @@
  */
 
 #include <stdio.h>
-#include <assert.h>
 #include <errno.h>
 #include <poll.h>
 #include <time.h>
@@ -11,6 +10,7 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "mgt.h"
 #include "mgt_event.h"
 #include "miniobj.h"
 #include "binary_heap.h"
index 2f46316c4851f017c719310be6334a2697fa2fd1..95c7c6a8c09dd3bab416b6d29c338daf97bbdc6a 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <sys/types.h>
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -16,7 +15,6 @@
 #include "vsb.h"
 #include "queue.h"
 
-#include "libvarnish.h"
 #include "libvcl.h"
 #include "cli.h"
 #include "cli_priv.h"
index 74747f7b51eca7a73f157d206ae8b6b98ff0391d..dbb344f47a9c1671f7abafcbfc2ad03ecd96b5f7 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdarg.h>
 #include <sys/mman.h>
 
-#include "libvarnish.h"
 #include "shmlog.h"
 #include "cache.h"
 
index ef0e97f7e2b0555750ca4aadd938c39a53b239e9..47bb31cad4a05e212e54be2694d9ab2f901f051e 100644 (file)
@@ -20,7 +20,6 @@
 #include <unistd.h>
 
 #include "compat.h"
-#include "libvarnish.h"
 #include "shmlog.h"
 #include "cache.h"
 
index 68bd8c0c930b8ba14f3541d37c7c894a8c28124e..5df51724f7ebe6f1cbe1515eefa4334ffaac5d64 100644 (file)
@@ -5,7 +5,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 
-#include <assert.h>
 #include <errno.h>
 #include <netdb.h>
 #include <stdio.h>
@@ -13,7 +12,6 @@
 
 #include "heritage.h"
 #include "mgt.h"
-#include "libvarnish.h"
 
 /*--------------------------------------------------------------------*/
 
index 904b597814abd79c2c035e92788570cd47e57695..c32e71333772786f201dd60d8a26ae6bcae2b9b5 100644 (file)
@@ -4,7 +4,6 @@
  * The management process and CLI handling
  */
 
-#include <assert.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -19,7 +18,6 @@
 
 #include "vsb.h"
 
-#include "libvarnish.h"
 #include "cli.h"
 #include "cli_priv.h"
 #include "cli_common.h"
index 3df3f2fe6781d8ac46838709985eb6ecb5f47dcb..3a07ae00402865f2fe0b3a7b30e0e6cba068724c 100644 (file)
@@ -9,7 +9,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <assert.h>
 #include <vis.h>
 
 #include "vsb.h"
index 372791c64b5bf24894d367b4532f776229b8574d..c8550d109a5d8c667716ef47be6d4b489c1ee8dd 100644 (file)
@@ -17,7 +17,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <assert.h>
 #include <vis.h>
 #include <time.h>
 
index 6ce91fd42be7f3944bb11353551e85ea420a7791..e310c9b404a4d22ba4a793453114e65616bd5992 100644 (file)
@@ -1,5 +1,4 @@
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
index 0818c726d985ab2c051fb75910bbc06eaf87e3f0..050836b40370fc405bb0ed62c874f1558d673dc5 100644 (file)
@@ -10,7 +10,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <assert.h>
 #include <curses.h>
 #include <vis.h>
 
index d1dd724de1800e2a6f2f10538833ea233baf16cf..d0684b93fcdd40945a41b5c996647f4efb0140a7 100644 (file)
@@ -2,6 +2,7 @@
  * $Id$
  */
 
+#include <errno.h>
 #include <time.h>
 
 /* from libvarnish/argv.c */
@@ -15,5 +16,18 @@ time_t TIM_parse(const char *p);
 /* from libvarnish/version.c */
 void varnish_version(const char *);
 
+/* from libvarnish/assert.c */
+#ifdef WITHOUT_ASSERTS
+#define assert(e)      ((void)0)
+#else /* WITH_ASSERTS */
+#define assert(e)                                                      \
+do {                                                                   \
+       if (e)                                                          \
+               __assert(__func__, __FILE__, __LINE__, #e, errno);      \
+} while (0)
+#endif
+
+void __assert(const char *, const char *, int, const char *, int);
+
 /* Assert zero return value */
 #define AZ(foo)        do { assert((foo) == 0); } while (0)
index 1a3469bced7e2d334afc598cefcecdb4fba14ae5..b94f9742e452ccd5a84d461dfa70a32614bfe7eb 100644 (file)
@@ -6,6 +6,7 @@ lib_LTLIBRARIES = libvarnish.la
 
 libvarnish_la_SOURCES = \
        argv.c \
+       assert.c \
        binary_heap.c \
        cli.c \
        cli_common.c \
index 29388f338caee41c1b3872fa00f6b29832a7f2ce..94adda917ad4e190a89a5f342d3e4a72ae097fc0 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <ctype.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
diff --git a/varnish-cache/lib/libvarnish/assert.c b/varnish-cache/lib/libvarnish/assert.c
new file mode 100644 (file)
index 0000000..2d86ed4
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+
+void
+__assert(const char *func, const char *file, int line, const char *cond, int err)
+{
+
+       fprintf(stderr,
+           "Assert error in %s(), %s line %s:\n"
+           "  Condition(%s) not true.\n"
+           "  errno = %d (%s)\n", func, file, line, cond, err, strerror(err));
+       abort();
+}
+