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

phk at projects.linpro.no phk at projects.linpro.no
Wed Jan 20 13:26:30 CET 2010


Author: phk
Date: 2010-01-20 13:26:29 +0100 (Wed, 20 Jan 2010)
New Revision: 4475

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_dir_random.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/stevedore.h
   trunk/varnish-cache/bin/varnishd/stevedore_utils.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
   trunk/varnish-cache/include/vbm.h
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.h
Log:
Various flexelint silencings.



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2010-01-20 12:26:29 UTC (rev 4475)
@@ -514,22 +514,22 @@
 void HTTP_Init(void);
 void http_ClrHeader(struct http *to);
 unsigned http_Write(struct worker *w, const struct http *hp, int resp);
-void http_CopyResp(struct http *to, const struct http *fm);
-void http_SetResp(struct http *to, const char *proto, const char *status,
+void http_CopyResp(const struct http *to, const struct http *fm);
+void http_SetResp(const struct http *to, const char *proto, const char *status,
     const char *response);
 void http_FilterFields(struct worker *w, int fd, struct http *to,
     const struct http *fm, unsigned how);
 void http_FilterHeader(const struct sess *sp, unsigned how);
-void http_PutProtocol(struct worker *w, int fd, struct http *to,
+void http_PutProtocol(struct worker *w, int fd, const struct http *to,
     const char *protocol);
 void http_PutStatus(struct worker *w, int fd, struct http *to, int status);
-void http_PutResponse(struct worker *w, int fd, struct http *to,
+void http_PutResponse(struct worker *w, int fd, const struct http *to,
     const char *response);
 void http_PrintfHeader(struct worker *w, int fd, struct http *to,
     const char *fmt, ...);
 void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr);
-void http_SetH(struct http *to, unsigned n, const char *fm);
-void http_ForceGet(struct http *to);
+void http_SetH(const struct http *to, unsigned n, const char *fm);
+void http_ForceGet(const struct http *to);
 void http_Setup(struct http *ht, struct ws *ws);
 int http_GetHdr(const struct http *hp, const char *hdr, char **ptr);
 int http_GetHdrField(const struct http *hp, const char *hdr,
@@ -540,8 +540,8 @@
 int http_DissectRequest(struct sess *sp);
 int http_DissectResponse(struct worker *w, const struct http_conn *htc,
     struct http *sp);
-const char *http_DoConnection(struct http *hp);
-void http_CopyHome(struct worker *w, int fd, struct http *hp);
+const char *http_DoConnection(const struct http *hp);
+void http_CopyHome(struct worker *w, int fd, const struct http *hp);
 void http_Unset(struct http *hp, const char *hdr);
 
 /* cache_httpconn.c */

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -86,7 +86,7 @@
 	int i, k;
 	struct vdi_random *vs;
 	double r, s1;
-	unsigned u;
+	unsigned u = 0;
 	struct vbe_conn *vbe;
 	struct director *d2;
 	struct SHA256Context ctx;

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -284,7 +284,7 @@
  */
 
 const char *
-http_DoConnection(struct http *hp)
+http_DoConnection(const struct http *hp)
 {
 	char *p, *q;
 	const char *ret;
@@ -588,7 +588,7 @@
 /*--------------------------------------------------------------------*/
 
 void
-http_SetH(struct http *to, unsigned n, const char *fm)
+http_SetH(const struct http *to, unsigned n, const char *fm)
 {
 
 	assert(n < to->shd);
@@ -599,7 +599,7 @@
 }
 
 static void
-http_copyh(struct http *to, const struct http *fm, unsigned n)
+http_copyh(const struct http *to, const struct http *fm, unsigned n)
 {
 
 	assert(n < to->shd);
@@ -609,14 +609,14 @@
 }
 
 void
-http_ForceGet(struct http *to)
+http_ForceGet(const struct http *to)
 {
 	if (strcmp(http_GetReq(to), "GET"))
 		http_SetH(to, HTTP_HDR_REQ, "GET");
 }
 
 void
-http_CopyResp(struct http *to, const struct http *fm)
+http_CopyResp(const struct http *to, const struct http *fm)
 {
 
 	CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
@@ -630,7 +630,7 @@
 }
 
 void
-http_SetResp(struct http *to, const char *proto, const char *status,
+http_SetResp(const struct http *to, const char *proto, const char *status,
     const char *response)
 {
 
@@ -742,7 +742,7 @@
  */
 
 void
-http_CopyHome(struct worker *w, int fd, struct http *hp)
+http_CopyHome(struct worker *w, int fd, const struct http *hp)
 {
 	unsigned u, l;
 	char *p;
@@ -801,7 +801,7 @@
 /*--------------------------------------------------------------------*/
 
 static void
-http_PutField(struct worker *w, int fd, struct http *to, int field,
+http_PutField(struct worker *w, int fd, const struct http *to, int field,
     const char *string)
 {
 	char *p;
@@ -824,7 +824,7 @@
 }
 
 void
-http_PutProtocol(struct worker *w, int fd, struct http *to,
+http_PutProtocol(struct worker *w, int fd, const struct http *to,
     const char *protocol)
 {
 
@@ -843,7 +843,7 @@
 }
 
 void
-http_PutResponse(struct worker *w, int fd, struct http *to,
+http_PutResponse(struct worker *w, int fd, const struct http *to,
     const char *response)
 {
 

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2010-01-20 12:26:29 UTC (rev 4475)
@@ -39,6 +39,9 @@
 -esym(755, VSTAILQ_*)
 -esym(755, VTAILQ_*)
 
+// XXX: I think this is a flexelint bug:
+-esym(522, vbit_clr)
+
 // Stuff used outside varnishd
 -esym(759, BackSlash)
 -esym(765, BackSlash)

Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -44,7 +44,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "compat/asprintf.h"
 #include "vsb.h"
 
 #include "libvcl.h"
@@ -356,13 +355,14 @@
 			return (1);
 		}
 
-		asprintf(&vcl,
+		bprintf(buf,
 		    "backend default {\n"
 		    "    .host = \"%s\";\n"
 		    "    .port = \"%s\";\n"
 		    "}\n", addr, port ? port : "http");
 		free(addr);
 		free(port);
+		vcl = strdup(buf);
 		AN(vcl);
 		bprintf(buf, "boot (-b %s)", b_arg);
 	} else {

Modified: trunk/varnish-cache/bin/varnishd/stevedore.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.h	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/stevedore.h	2010-01-20 12:26:29 UTC (rev 4475)
@@ -39,8 +39,6 @@
 typedef void storage_open_f(const struct stevedore *);
 typedef struct storage *storage_alloc_f(struct stevedore *, size_t size,
     struct objcore *);
-typedef struct object *storage_alloc_obj_f(struct stevedore *, size_t size,
-    double ttl);
 typedef void storage_trim_f(struct storage *, size_t size);
 typedef void storage_free_f(struct storage *);
 typedef void storage_object_f(const struct sess *sp);
@@ -54,7 +52,6 @@
 	storage_init_f		*init;	/* called by mgt process */
 	storage_open_f		*open;	/* called by cache process */
 	storage_alloc_f		*alloc;
-	storage_alloc_obj_f	*allocobj;
 	storage_trim_f		*trim;
 	storage_free_f		*free;
 	storage_object_f	*object;

Modified: trunk/varnish-cache/bin/varnishd/stevedore_utils.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore_utils.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/stevedore_utils.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -55,7 +55,6 @@
 #include <sys/vfs.h>
 #endif
 
-#include "compat/asprintf.h"
 #include "mgt.h"
 #include "stevedore.h"
 
@@ -86,6 +85,7 @@
 	struct stat st;
 	char *q;
 	int retval = 1;
+	char buf[FILENAME_MAX];
 
 	AN(fn);
 	AN(fnp);
@@ -107,13 +107,13 @@
 		    ctx, fn);
 
 	if (S_ISDIR(st.st_mode)) {
-		xxxassert(asprintf(&q, "%s/varnish.XXXXXX", fn) > 0);
-		XXXAN(q);
-		fd = mkstemp(q);
+		bprintf(buf, "%s/varnish.XXXXXX", fn);
+		fd = mkstemp(buf);
 		if (fd < 0)
 			ARGV_ERR("(%s) \"%s\" mkstemp(%s) failed (%s)\n",
 			    ctx, fn, q, strerror(errno));
-		*fnp = q;
+		*fnp = strdup(buf);
+		AN(*fnp);
 		retval = 2;
 	} else if (S_ISREG(st.st_mode)) {
 		fd = open(fn, O_RDWR | O_LARGEFILE);

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -49,7 +49,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "compat/asprintf.h"
 #include "compat/daemon.h"
 
 #ifndef HAVE_STRLCPY
@@ -438,14 +437,9 @@
 	FILE *fi;
 	uintptr_t a;
 	struct symbols *s;
-	int i;
 
-	p = NULL;
-	i = asprintf(&p, "nm -an %s 2>/dev/null", a0);
-	if (i < 0 || p == NULL)
-		return;
-	fi = popen(p, "r");
-	free(p);
+	bprintf(buf, "nm -an %s 2>/dev/null", a0);
+	fi = popen(buf, "r");
 	if (fi == NULL)
 		return;
 	while (fgets(buf, sizeof buf, fi)) {

Modified: trunk/varnish-cache/include/vbm.h
===================================================================
--- trunk/varnish-cache/include/vbm.h	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/include/vbm.h	2010-01-20 12:26:29 UTC (rev 4475)
@@ -85,7 +85,7 @@
 }
 
 static inline void
-vbit_clr(struct vbitmap *vb, unsigned bit)
+vbit_clr(const struct vbitmap *vb, unsigned bit)
 {
 
 	if (bit < vb->nbits)
@@ -93,7 +93,7 @@
 }
 
 static inline int
-vbit_test(struct vbitmap *vb, unsigned bit)
+vbit_test(const struct vbitmap *vb, unsigned bit)
 {
 
 	if (bit >= vb->nbits)

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-01-20 12:26:29 UTC (rev 4475)
@@ -96,8 +96,8 @@
 
 /*--------------------------------------------------------------------*/
 
-void
-TlFree(struct tokenlist *tl, void *p)
+static void
+TlDoFree(struct tokenlist *tl, void *p)
 {
 	struct membit *mb;
 
@@ -115,7 +115,7 @@
 
 	p = calloc(len, 1);
 	assert(p != NULL);
-	TlFree(tl, p);
+	TlDoFree(tl, p);
 	return (p);
 }
 

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-01-20 11:22:51 UTC (rev 4474)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-01-20 12:26:29 UTC (rev 4475)
@@ -176,7 +176,6 @@
 void Ff(const struct tokenlist *tl, int indent, const char *fmt, ...);
 void EncToken(struct vsb *sb, const struct token *t);
 int IsMethod(const struct token *t);
-void TlFree(struct tokenlist *tl, void *p);
 void *TlAlloc(struct tokenlist *tl, unsigned len);
 
 /* vcc_dir_random.c */



More information about the varnish-commit mailing list