r2189 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 29 13:10:16 CET 2007


Author: phk
Date: 2007-10-29 13:10:16 +0100 (Mon, 29 Oct 2007)
New Revision: 2189

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_ws.c
Log:
Give struct ws the mini_obj treatment, not sure why I didn't before.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-10-29 12:09:54 UTC (rev 2188)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-10-29 12:10:16 UTC (rev 2189)
@@ -90,6 +90,8 @@
  */
 
 struct ws {
+	unsigned		magic;
+#define WS_MAGIC		0x35fac554
 	const char		*id;		/* identity */
 	char			*s;		/* (S)tart of buffer */
 	char			*f;		/* (F)ree pointer */

Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-29 12:09:54 UTC (rev 2188)
+++ trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-29 12:10:16 UTC (rev 2189)
@@ -56,7 +56,7 @@
 WS_Assert(const struct ws *ws)
 {
 
-	assert(ws != NULL);
+	CHECK_OBJ_NOTNULL(ws, WS_MAGIC);
 	WS_DEBUG((SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)",
 	    ws, ws->id, ws->s, pdiff(ws->s, ws->f),
 	    ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
@@ -79,6 +79,7 @@
 	WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len));
 	assert(space != NULL);
 	memset(ws, 0, sizeof *ws);
+	ws->magic = WS_MAGIC;
 	ws->s = space;
 	ws->e = ws->s + len;
 	ws->f = ws->s;




More information about the varnish-commit mailing list