r3004 - in trunk/varnish-cache: bin/varnishd lib/libvarnish lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Wed Jul 23 19:37:45 CEST 2008


Author: phk
Date: 2008-07-23 19:37:44 +0200 (Wed, 23 Jul 2008)
New Revision: 3004

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/lib/libvarnish/cli_common.c
   trunk/varnish-cache/lib/libvcl/vcc_acl.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.h
   trunk/varnish-cache/lib/libvcl/vcc_token.c
   trunk/varnish-cache/lib/libvcl/vcc_xref.c
Log:
More Flexelint nitpickery



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -118,6 +118,7 @@
 
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} ap,hp could be const */
 static char *
 vrt_assemble_string(struct http *hp, const char *h, const char *p, va_list ap)
 {
@@ -419,6 +420,7 @@
 	sp->director = be;
 }
 
+/*lint -e{818} sp could be const */
 struct director *
 VRT_r_req_backend(struct sess *sp)
 {
@@ -450,6 +452,7 @@
 	sp->grace = a;
 }
 
+/*lint -e{818} sp could be const */
 double
 VRT_r_req_grace(struct sess *sp)
 {
@@ -626,6 +629,7 @@
 	
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} sp could be const */
 void
 VRT_panic(struct sess *sp, const char *str, ...)
 {

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2008-07-23 17:37:44 UTC (rev 3004)
@@ -10,7 +10,9 @@
 -efile(766, ../../config.h)
 -emacro(413, offsetof)	// likely null pointer
 
+-emacro(702, WEXITSTATUS)	// signed shift right 
 
+
 // -header(../../config.h)
 
 // Fix strchr() semtics, it can only return NULL if arg2 != 0
@@ -38,6 +40,10 @@
 -emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small)
 -emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean
 
+-esym(765, vcc_ProcAction) // could be made static
+-esym(759, vcc_ProcAction) // could be moved to module
+-esym(714, vcc_ProcAction) // not ref.
+
 -esym(534, sprintf)	// Ignoring return value of function
 -esym(534, asprintf)	// Ignoring return value of function
 -esym(534, printf)	// Ignoring return value of function

Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -544,6 +544,7 @@
 
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} priv could be const */
 void
 mcf_server_startstop(struct cli *cli, const char * const *av, void *priv)
 {

Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/cli_common.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/lib/libvarnish/cli_common.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -68,6 +68,7 @@
 	va_end(ap);
 }
 
+/*lint -e{818} cli could be const */
 void
 cli_quote(struct cli *cli, const char *s)
 {

Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_acl.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/lib/libvcl/vcc_acl.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -155,7 +155,7 @@
 	AN(ae2);
 	*ae2 = *ae;
 
-	ae2->data[0] = fam;
+	ae2->data[0] = fam & 0xff;
 	ae2->mask += 8;	/* family matching */
 
 	memcpy(ae2->data + 1, u, l);
@@ -171,7 +171,7 @@
 	struct sockaddr_in *sin4;
 	struct sockaddr_in6 *sin6;
 	unsigned char *u, i4, i6;
-	int error, l;
+	int error;
 
 	memset(&hint, 0, sizeof hint);
 	hint.ai_family = PF_UNSPEC;
@@ -204,21 +204,23 @@
 		switch(res->ai_family) {
 		case PF_INET:
 			sin4 = (void*)res->ai_addr;
+			assert(sizeof(sin4->sin_family) == 1);
+			assert(sizeof(sin4->sin_addr) == 4);
 			u = (void*)&sin4->sin_addr;
-			l = 4;
 			if (ae->t_mask == NULL)
 				ae->mask = 32;
 			i4++;
-			vcc_acl_emit_entry(tl, ae, l, u, res->ai_family);
+			vcc_acl_emit_entry(tl, ae, 4, u, res->ai_family);
 			break;
 		case PF_INET6:
 			sin6 = (void*)res->ai_addr;
+			assert(sizeof(sin4->sin_family) == 1);
+			assert(sizeof(sin4->sin_addr) == 16);
 			u = (void*)&sin6->sin6_addr;
-			l = 16;
 			if (ae->t_mask == NULL)
 				ae->mask = 128;
 			i6++;
-			vcc_acl_emit_entry(tl, ae, l, u, res->ai_family);
+			vcc_acl_emit_entry(tl, ae, 16, u, res->ai_family);
 			break;
 		default:
 			vsb_printf(tl->sb,

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h	2008-07-23 17:37:44 UTC (rev 3004)
@@ -208,7 +208,6 @@
 void vcc__Expect(struct tokenlist *tl, unsigned tok, int line);
 int vcc_Teq(const struct token *t1, const struct token *t2);
 int vcc_IdIs(const struct token *t, const char *p);
-int vcc_isCid(const struct token *t);
 void vcc_ExpectCid(struct tokenlist *tl);
 void vcc_Lexer(struct tokenlist *tl, struct source *sp);
 void vcc_NextToken(struct tokenlist *tl);

Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -191,7 +191,7 @@
  * Check that we have a C-identifier
  */
 
-int
+static int
 vcc_isCid(const struct token *t)
 {
 	const char *q;
@@ -266,7 +266,7 @@
 			vcc_ErrWhere(tl, tl->t);
 			return(1);
 		}
-		u = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]);
+		u = (vcc_xdig(p[1]) * 16 + vcc_xdig(p[2])) & 0xff;
 		if (!isgraph(u)) {
 			vcc_AddToken(tl, CSTR, p, p + 3);
 			vsb_printf(tl->sb,
@@ -301,12 +301,6 @@
 	else
 		VTAILQ_INSERT_TAIL(&tl->tokens, t, list);
 	tl->t = t;
-	if (0) {
-		fprintf(stderr, "[%s %.*s] ",
-		    vcl_tnames[tok], PF(t));
-		if (tok == EOI)
-			fprintf(stderr, "\n");
-	}
 }
 
 /*--------------------------------------------------------------------

Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_xref.c	2008-07-23 17:09:53 UTC (rev 3003)
+++ trunk/varnish-cache/lib/libvcl/vcc_xref.c	2008-07-23 17:37:44 UTC (rev 3004)
@@ -242,7 +242,7 @@
 vcc_ProcAction(struct proc *p, unsigned returns, struct token *t)
 {
 
-	p->returns |= (1 << returns);
+	p->returns |= (1U << returns);
 	/* Record the first instance of this return */
 	if (p->return_tok[returns] == NULL)
 		p->return_tok[returns] = t;
@@ -266,16 +266,15 @@
 	}
 	u = p->returns & ~returns;
 	if (u) {
-/*lint -e525 */
+/*lint -save -e525 -e539 */
 #define VCL_RET_MAC(a, b, c, d) \
 		if (u & VCL_RET_##b) { \
 			vsb_printf(tl->sb, "Invalid return \"%s\"\n", #a); \
 			vcc_ErrWhere(tl, p->return_tok[d]); \
 		}
-/*lint -e525 */
 #include "vcl_returns.h"
-/*lint +e525 */
 #undef VCL_RET_MAC
+/*lint -restore */
 		vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
 		vcc_ErrWhere(tl, p->name);
 		return (1);
@@ -314,11 +313,12 @@
 			if (m->returns & c) \
 				vsb_printf(tl->sb, " \"%s\"", #a);
 #define VCL_RET_MAC_E(a, b, c, d) VCL_RET_MAC(a, b, c, d)
-/*lint -e525 */
+/*lint -save -e525 -e539 */
 #include "vcl_returns.h"
 /*lint +e525 */
 #undef VCL_RET_MAC
 #undef VCL_RET_MAC_E
+/*lint -restore */
 			vsb_printf(tl->sb, "\n");
 			return (1);
 		}




More information about the varnish-commit mailing list