r2968 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Jul 19 14:38:29 CEST 2008


Author: phk
Date: 2008-07-19 14:38:28 +0200 (Sat, 19 Jul 2008)
New Revision: 2968

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_dir_random.c
   trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
   trunk/varnish-cache/bin/varnishd/cache_dir_simple.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_vary.c
Log:
More assorted FlexeLint polishing



Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -98,7 +98,7 @@
 
 	tmo = params->connect_timeout;
 	if (sp->backend->connect_timeout > 10e-3)
-		tmo = sp->backend->connect_timeout * 1000;
+		tmo = (int)(sp->backend->connect_timeout * 1000);
 
 	if (tmo > 0)
 		i = TCP_connect(s, sa, salen, tmo);

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -72,7 +72,6 @@
 
 #include "shmlog.h"
 #include "vcl.h"
-#include "cli.h"
 #include "cli_priv.h"
 #include "cache.h"
 

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -61,6 +61,7 @@
 };
 
 
+/*lint -e{818} not const-able */
 static struct backend *
 vdi_random_choose(struct sess *sp)
 {
@@ -81,6 +82,7 @@
 	return (NULL);
 }
 
+/*lint -e{818} not const-able */
 static void
 vdi_random_fini(struct director *d)
 {

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -60,6 +60,7 @@
 };
 
 
+/*lint -e{818} not const-able */
 static struct backend *
 vdi_round_robin_choose(struct sess *sp)
 {
@@ -75,6 +76,7 @@
 	return (backend);
 }
 
+/*lint -e{818} not const-able */
 static void
 vdi_round_robin_fini(struct director *d)
 {

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_simple.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_simple.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -54,6 +54,7 @@
 	struct backend		*backend;
 };
 
+/*lint -e{818} not const-able */
 static struct backend *
 vdi_simple_choose(struct sess *sp)
 {
@@ -64,6 +65,7 @@
 	return (vs->backend);
 }
 
+/*lint -e{818} not const-able */
 static void
 vdi_simple_fini(struct director *d)
 {

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -53,6 +53,7 @@
 #include "http_headers.h"
 #undef HTTPH
 
+/*lint -save -e773 not () */
 #define LOGMTX2(ax, bx, cx) 	[bx] = SLT_##ax##cx
 
 #define LOGMTX1(ax) { 		\
@@ -69,6 +70,7 @@
 	[HTTP_Tx] = LOGMTX1(Tx),
 	[HTTP_Obj] = LOGMTX1(Obj)
 };
+/*lint -restore */
 
 static enum shmlogtag
 http2shmlog(const struct http *hp, int t)
@@ -551,20 +553,20 @@
 }
 
 static void
-http_copyreq(struct http *to, const struct http *fm, int transparent)
+http_copyreq(struct http *to, const struct http *fm, int how)
 {
 
 	CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-	if (transparent)
+
+	if ((how == HTTPH_R_PIPE) || (how == HTTPH_R_PASS)) {
 		http_copyh(to, fm, HTTP_HDR_REQ);
-	else
+		http_copyh(to, fm, HTTP_HDR_PROTO);
+	} else {
 		http_SetH(to, HTTP_HDR_REQ, "GET");
+		http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
+	}
 	http_copyh(to, fm, HTTP_HDR_URL);
-	if (transparent)
-		http_copyh(to, fm, HTTP_HDR_PROTO);
-	else
-		http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
 }
 
 void
@@ -645,8 +647,7 @@
         hp = bereq->http;
         hp->logtag = HTTP_Tx;
 
-	http_copyreq(hp, sp->http,
-	    (how == HTTPH_R_PIPE) || (how == HTTPH_R_PASS));
+	http_copyreq(hp, sp->http, how);
 	http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how);
 	http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid);
 	http_PrintfHeader(sp->wrk, sp->fd, hp,

Modified: trunk/varnish-cache/bin/varnishd/cache_vary.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vary.c	2008-07-19 12:04:25 UTC (rev 2967)
+++ trunk/varnish-cache/bin/varnishd/cache_vary.c	2008-07-19 12:38:28 UTC (rev 2968)
@@ -107,7 +107,8 @@
 				e--;
 			/* Encode two byte length and contents */
 			l = e - h;
-			vsb_printf(sb, "%c%c", l >> 8, l & 0xff);
+			assert(!(l & ~0xffff));
+			vsb_printf(sb, "%c%c", (unsigned)l >> 8, l & 0xff);
 			vsb_bcat(sb, h, e - h);
 		} else {
 			/* Mark as "not present" */




More information about the varnish-commit mailing list