From: phk Date: Mon, 29 Oct 2007 12:10:16 +0000 (+0000) Subject: Give struct ws the mini_obj treatment, not sure why I didn't before. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f336229f155fcd09d4f458759ac6b29c0bd80687;p=varnish Give struct ws the mini_obj treatment, not sure why I didn't before. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2189 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index e2336942..6970ae29 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -90,6 +90,8 @@ enum step { */ struct ws { + unsigned magic; +#define WS_MAGIC 0x35fac554 const char *id; /* identity */ char *s; /* (S)tart of buffer */ char *f; /* (F)ree pointer */ diff --git a/varnish-cache/bin/varnishd/cache_ws.c b/varnish-cache/bin/varnishd/cache_ws.c index 2ef8bcee..176c0bce 100644 --- a/varnish-cache/bin/varnishd/cache_ws.c +++ b/varnish-cache/bin/varnishd/cache_ws.c @@ -56,7 +56,7 @@ void 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_Init(struct ws *ws, const char *id, void *space, unsigned len) 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;