r499 - trunk/varnish-cache/include
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jul 19 14:36:42 CEST 2006
Author: phk
Date: 2006-07-19 14:36:42 +0200 (Wed, 19 Jul 2006)
New Revision: 499
Added:
trunk/varnish-cache/include/miniobj.h
Log:
Add miniobj.h for debugging
Added: trunk/varnish-cache/include/miniobj.h
===================================================================
--- trunk/varnish-cache/include/miniobj.h 2006-07-19 11:53:06 UTC (rev 498)
+++ trunk/varnish-cache/include/miniobj.h 2006-07-19 12:36:42 UTC (rev 499)
@@ -0,0 +1,33 @@
+/* $Id$ */
+
+#define FREE_OBJ(to) \
+ do { \
+ (to)->magic = (0); \
+ free(to); \
+ } while (0)
+
+#define CHECK_OBJ(ptr, type_magic) \
+ do { \
+ assert((ptr)->magic == type_magic); \
+ } while (0)
+
+#define CHECK_OBJ_NOTNULL(ptr, type_magic) \
+ do { \
+ assert((ptr) != NULL); \
+ assert((ptr)->magic == type_magic); \
+ } while (0)
+
+#define CAST_OBJ(to, from, type_magic) \
+ do { \
+ (to) = (from); \
+ if ((to) != NULL) \
+ CHECK_OBJ((to), (type_magic)); \
+ } while (0);
+
+#define CAST_OBJ_NOTNULL(to, from, type_magic) \
+ do { \
+ (to) = (from); \
+ assert((to) != NULL); \
+ CHECK_OBJ((to), (type_magic)); \
+ } while (0);
+
More information about the varnish-commit
mailing list