From fe2e9be56a3526be5178757409ea941f43033c17 Mon Sep 17 00:00:00 2001 From: des Date: Tue, 30 Oct 2007 13:42:52 +0000 Subject: [PATCH] Simplify WS_DEBUG(), and make it conditional on DIAGNOSTICS. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2213 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_ws.c | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_ws.c b/varnish-cache/bin/varnishd/cache_ws.c index 176c0bce..8c7a9ccd 100644 --- a/varnish-cache/bin/varnishd/cache_ws.c +++ b/varnish-cache/bin/varnishd/cache_ws.c @@ -46,10 +46,10 @@ #include "cache.h" /* Enable this to get detailed logging of WS usage */ -#if 0 -# define WS_DEBUG(foo) VSL foo +#ifdef DIAGNOSTICS +# define WS_DEBUG(fmt, ...) VSL(SLT_Debug, 0, fmt, __VA_ARGS__) #else -# define WS_DEBUG(foo) /* nothing */ +# define WS_DEBUG(fmt, ...) /* nothing */ #endif void @@ -57,10 +57,10 @@ WS_Assert(const struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); - WS_DEBUG((SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)", + WS_DEBUG("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), - pdiff(ws->s, ws->e))); + pdiff(ws->s, ws->e)); assert(ws->s != NULL); assert(ws->e != NULL); assert(ws->s < ws->e); @@ -76,7 +76,7 @@ void 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)); + WS_DEBUG("WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len); assert(space != NULL); memset(ws, 0, sizeof *ws); ws->magic = WS_MAGIC; @@ -92,7 +92,7 @@ WS_Reset(struct ws *ws, char *p) { WS_Assert(ws); - WS_DEBUG((SLT_Debug, 0, "WS_Reset(%p, %p)", ws, p)); + WS_DEBUG("WS_Reset(%p, %p)", ws, p); assert(ws->r == NULL); if (p == NULL) ws->f = ws->s; @@ -114,7 +114,7 @@ WS_Alloc(struct ws *ws, unsigned bytes) return(NULL); r = ws->f; ws->f += bytes; - WS_DEBUG((SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r)); + WS_DEBUG("WS_Alloc(%p, %u) = %p", ws, bytes, r); return (r); } @@ -128,7 +128,7 @@ WS_Dup(struct ws *ws, const char *s) p = WS_Alloc(ws, l); if (p != NULL) memcpy(p, s, l); - WS_DEBUG((SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p)); + WS_DEBUG("WS_Dup(%p, \"%s\") = %p", ws, s, p); return (p); } @@ -138,7 +138,7 @@ WS_Snapshot(struct ws *ws) WS_Assert(ws); assert(ws->r == NULL); - WS_DEBUG((SLT_Debug, 0, "WS_Snapshot(%p) = %p", ws, ws->f)); + WS_DEBUG("WS_Snapshot(%p) = %p", ws, ws->f); return (ws->f); } @@ -153,8 +153,8 @@ WS_Reserve(struct ws *ws, unsigned bytes) b2 = ws->e - ws->f; xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; - WS_DEBUG((SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", - ws, b2, bytes, pdiff(ws->f, ws->r))); + WS_DEBUG("WS_Reserve(%p, %u/%u) = %u", + ws, b2, bytes, pdiff(ws->f, ws->r)); return (pdiff(ws->f, ws->r)); } @@ -162,7 +162,7 @@ void WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); - WS_DEBUG((SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes)); + WS_DEBUG("WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); assert(ws->f + bytes <= ws->r); ws->f += bytes; @@ -173,7 +173,7 @@ void WS_ReleaseP(struct ws *ws, char *ptr) { WS_Assert(ws); - WS_DEBUG((SLT_Debug, 0, "WS_ReleaseP(%p, %p)", ws, ptr)); + WS_DEBUG("WS_ReleaseP(%p, %p)", ws, ptr); assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); -- 2.39.5