r4209 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Wed Aug 26 09:25:55 CEST 2009


Author: phk
Date: 2009-08-26 09:25:54 +0200 (Wed, 26 Aug 2009)
New Revision: 4209

Modified:
   trunk/varnish-cache/bin/varnishd/cache_ban.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/include/purge_vars.h
   trunk/varnish-cache/lib/libvcl/vcc_action.c
Log:
Silence some FlexeLint warnings



Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c	2009-08-24 14:51:26 UTC (rev 4208)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c	2009-08-26 07:25:54 UTC (rev 4209)
@@ -235,7 +235,7 @@
 	unsigned		flag;
 	ban_cond_f		*func;
 } pvars[] = {
-#define PVAR(a, b, c)	{ a, b, c },
+#define PVAR(a, b, c)	{ (a), (b), (c) },
 #include "purge_vars.h"
 #undef PVAR
 	{ 0, 0, 0}
@@ -286,9 +286,9 @@
 		if (strncmp(a1, pv->name, strlen(pv->name)))
 			continue;
 		bt->func = pv->func;
-		if (pv->flag & 2)
+		if (pv->flag & PVAR_REQ)
 			b->flags |= BAN_F_REQ;
-		if (pv->flag & 1) 
+		if (pv->flag & PVAR_HTTP) 
 			ban_parse_http(bt, a1 + strlen(pv->name));
 		break;
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-08-24 14:51:26 UTC (rev 4208)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-08-26 07:25:54 UTC (rev 4209)
@@ -307,6 +307,7 @@
 	assert(a > 0);
 	
 	ALLOC_OBJ(new, TROUBLE_MAGIC);
+	AN(new);
 	new->objhead = sp->objhead;
 	new->timeout = sp->t_req + a;
 

Modified: trunk/varnish-cache/include/purge_vars.h
===================================================================
--- trunk/varnish-cache/include/purge_vars.h	2009-08-24 14:51:26 UTC (rev 4208)
+++ trunk/varnish-cache/include/purge_vars.h	2009-08-26 07:25:54 UTC (rev 4209)
@@ -29,12 +29,12 @@
  *
  * Define which variables we can purge on, and which function does it.
  *
- * Middle field is a bitmap:
- *   1 = HTTP header search
- *   2 = Needs a client supplied request for test evaluation
  */
 
-PVAR("req.url",		2|0, ban_cond_url)
-PVAR("obj.hash", 	0|0, ban_cond_hash)
-PVAR("req.http.",	2|1, ban_cond_req_http)
-PVAR("obj.http.",	0|1, ban_cond_obj_http)
+#define PVAR_HTTP	1
+#define PVAR_REQ	2
+
+PVAR("req.url",		PVAR_REQ,		ban_cond_url)
+PVAR("obj.hash", 	0,			ban_cond_hash)
+PVAR("req.http.",	PVAR_REQ|PVAR_HTTP,	ban_cond_req_http)
+PVAR("obj.http.",	PVAR_HTTP,		ban_cond_obj_http)

Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c	2009-08-24 14:51:26 UTC (rev 4208)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c	2009-08-26 07:25:54 UTC (rev 4209)
@@ -350,7 +350,7 @@
 	const char	*name;
 	unsigned	flag;
 } purge_var[] = {
-#define PVAR(a, b, c)   { a, b },
+#define PVAR(a, b, c)   { (a), (b) },
 #include "purge_vars.h"
 #undef PVAR     
         { 0, 0 }
@@ -383,7 +383,7 @@
 				vcc_ErrWhere(tl, tl->t);
 				return;
 			}
-			if ((pv->flag & 1) &&
+			if ((pv->flag & PVAR_HTTP) &&
 			    tl->t->b + strlen(pv->name) >= tl->t->e) {
 				vsb_printf(tl->sb, "Missing header name.");
 				vcc_ErrWhere(tl, tl->t);



More information about the varnish-commit mailing list