r2763 - trunk/varnish-cache/include

phk at projects.linpro.no phk at projects.linpro.no
Sat Jun 21 23:03:33 CEST 2008


Author: phk
Date: 2008-06-21 23:03:27 +0200 (Sat, 21 Jun 2008)
New Revision: 2763

Modified:
   trunk/varnish-cache/include/libvarnish.h
Log:
Add a diagnostic() wrapper around assert() for checks which are so expensive
that we may want to compile them out for performance at a latter date.



Modified: trunk/varnish-cache/include/libvarnish.h
===================================================================
--- trunk/varnish-cache/include/libvarnish.h	2008-06-21 20:56:14 UTC (rev 2762)
+++ trunk/varnish-cache/include/libvarnish.h	2008-06-21 21:03:27 UTC (rev 2763)
@@ -62,7 +62,12 @@
 
 /*
  * assert(), AN() and AZ() are static checks that should not happen.
- * xxxassert(), XXXAN() and XXXAZ() are markers for missing code.
+ *	In general asserts should be cheap, such as checking return
+ *	values and similar.
+ * diagnostic() are asserts which are so expensive that we may want
+ *	to compile them out for performance at a later date.
+ * xxxassert(), XXXAN() and XXXAZ() marks conditions we ought to
+ *	handle gracefully, such as malloc failure.
  */
 
 #ifdef WITHOUT_ASSERTS
@@ -89,3 +94,4 @@
 #define AN(foo)	do { assert((foo) != 0); } while (0)
 #define XXXAZ(foo)	do { xxxassert((foo) == 0); } while (0)
 #define XXXAN(foo)	do { xxxassert((foo) != 0); } while (0)
+#define diagnostic(foo)	assert(foo)




More information about the varnish-commit mailing list