r466 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 13 01:30:49 CEST 2006


Author: phk
Date: 2006-07-13 01:30:49 +0200 (Thu, 13 Jul 2006)
New Revision: 466

Modified:
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_main.c
   trunk/varnish-cache/bin/varnishd/cache_pass.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/cli_event.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/flint.sh
   trunk/varnish-cache/bin/varnishd/rfc2616.c
   trunk/varnish-cache/bin/varnishd/shmlog.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
More Flexelinting


Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -92,7 +92,7 @@
 	}
 	if (o != NULL) {
 		AZ(pthread_mutex_unlock(&oh->mtx));
-		hash->deref(oh);
+		(void)hash->deref(oh);
 		return (o);
 	}
 

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -338,12 +338,14 @@
 #include <errno.h>
 
 static void
-http_read_f(int fd, short event __unused, void *arg)
+http_read_f(int fd, short event, void *arg)
 {
 	struct http *hp = arg;
 	unsigned l;
 	int i, ret = 0;
 
+	(void)event;
+
 	l = hp->e - hp->v;
 	if (l <= 1) {
 		VSL(SLT_HttpError, fd, "Received too much");
@@ -391,7 +393,8 @@
 	assert(hp->v <= hp->e);
 	assert(hp->t <= hp->v);
 	if (0)
-	VSL(SLT_Debug, fd, "Recv t %u v %u", hp->t - hp->s, hp->v - hp->s);
+		VSL(SLT_Debug, fd, "Recv t %u v %u",
+		    hp->t - hp->s, hp->v - hp->s);
 	if (hp->t > hp->s && hp->t < hp->v) {
 		l = hp->v - hp->t;
 		memmove(hp->s, hp->t, l);
@@ -409,8 +412,8 @@
 	hp->callback = func;
 	hp->arg = arg;
 	event_set(&hp->ev, fd, EV_READ | EV_PERSIST, http_read_f, hp);
-	event_base_set(eb, &hp->ev);
-	event_add(&hp->ev, NULL);      /* XXX: timeout */
+	AZ(event_base_set(eb, &hp->ev));
+	AZ(event_add(&hp->ev, NULL));      /* XXX: timeout */
 }
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/cache_main.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_main.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_main.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -20,15 +20,13 @@
 
 struct stevedore	*stevedore;
 
-struct varnish_stats *VSL_stats;
-
 /*--------------------------------------------------------------------*/
 
 static void
 timer_keepalive(int a, short b, void *c)
 {
 
-	printf("%s(%d, %d, %p)\n", __func__, a, (int)b, c);
+	printf("%s(%d, %d, %p)\n", (const char *)__func__, a, (int)b, c);
 	printf("Heeellloooo ?   Ohh bother...\n");
 	exit (1);
 }
@@ -41,8 +39,8 @@
 	tv.tv_sec = 30;
 	tv.tv_usec = 0;
 
-	evtimer_del(&ev_keepalive);
-	evtimer_add(&ev_keepalive, &tv);
+	AZ(evtimer_del(&ev_keepalive));
+	AZ(evtimer_add(&ev_keepalive, &tv));
 }
 
 /*--------------------------------------------------------------------*/
@@ -69,7 +67,7 @@
 	if (av[2] != NULL) {
 		/* XXX: check clock skew is pointless here */
 	}
-	time(&t);
+	t = time(NULL);
 	cli_out(cli, "PONG %ld\n", t);
 }
 
@@ -126,7 +124,7 @@
 	cli = cli_setup(eb, heritage.fds[2], heritage.fds[1], 0, cli_proto);
 
 	evtimer_set(&ev_keepalive, timer_keepalive, NULL);
-	event_base_set(eb, &ev_keepalive);
+	AZ(event_base_set(eb, &ev_keepalive));
 	arm_keepalive();
 
 	printf("Ready\n");

Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -12,7 +12,6 @@
 #include <sys/socket.h>
 #include <netdb.h>
 
-#include "libvarnish.h"
 #include "shmlog.h"
 #include "cache.h"
 
@@ -204,7 +203,7 @@
 	 */
 	hp = vc->http;
 	http_RecvHead(hp, vc->fd, w->eb, NULL, NULL);
-	event_base_loop(w->eb, 0);
+	(void)event_base_loop(w->eb, 0);
 	http_DissectResponse(hp, vc->fd);
 
 	sp->bkd_http = hp;

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -18,24 +18,26 @@
 };
 
 static void
-rdf(int fd, short event __unused, void *arg)
+rdf(int fd, short event, void *arg)
 {
 	int i, j;
 	struct edir *ep;
 	char buf[BUFSIZ];
 
+	(void)event;
+
 	ep = arg;
 	i = read(fd, buf, sizeof buf);
 	if (i <= 0) {
 		shutdown(fd, SHUT_RD);
 		shutdown(ep->fd, SHUT_WR);
-		event_del(&ep->ev);
+		AZ(event_del(&ep->ev));
 	} else {
 		j = write(ep->fd, buf, i);
 		if (i != j) {
 			shutdown(fd, SHUT_WR);
 			shutdown(ep->fd, SHUT_RD);
-			event_del(&ep->ev);
+			AZ(event_del(&ep->ev));
 		}
 	}
 }
@@ -67,12 +69,12 @@
 	e1.fd = vc->fd;
 	e2.fd = sp->fd;
 	event_set(&e1.ev, sp->fd, EV_READ | EV_PERSIST, rdf, &e1);
-	event_base_set(w->eb, &e1.ev);
+	AZ(event_base_set(w->eb, &e1.ev));
 	event_set(&e2.ev, vc->fd, EV_READ | EV_PERSIST, rdf, &e2);
-	event_base_set(w->eb, &e2.ev);
-	event_add(&e1.ev, NULL);
-	event_add(&e2.ev, NULL);
-	event_base_loop(w->eb, 0);
+	AZ(event_base_set(w->eb, &e2.ev));
+	AZ(event_add(&e1.ev, NULL));
+	AZ(event_add(&e2.ev, NULL));
+	(void)event_base_loop(w->eb, 0);
 	vca_close_session(sp, "pipe");
 	VBE_ClosedFd(vc);
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -79,7 +79,7 @@
 		}
 
 		/* If we are a dynamic thread, time out and die */
-		clock_gettime(CLOCK_REALTIME, &ts);
+		AZ(clock_gettime(CLOCK_REALTIME, &ts));
 		ts.tv_sec += heritage.wthread_timeout;
 		if (pthread_cond_timedwait(&w->cv, &wrk_mtx, &ts)) {
 			VSL_stats->n_wrk--;
@@ -102,7 +102,7 @@
 	struct worker *w;
 	pthread_t tp;
 
-	time(&sp->t_req);
+	sp->t_req = time(NULL);
 
 	/*
 	 * No locking necessary, we're serialized in the acceptor thread

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -8,14 +8,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <dlfcn.h>
 
-#include "cli.h"
-#include "cli_priv.h"
 #include "shmlog.h"
 #include "vrt.h"
 #include "vcl.h"
-#include "libvarnish.h"
 #include "cache.h"
 
 /*--------------------------------------------------------------------*/
@@ -24,6 +20,7 @@
 VRT_error(struct sess *sp, unsigned err, const char *str)
 { 
 
+	(void)sp;
 	VSL(SLT_Debug, 0, "VCL_error(%u, %s)", err, str);
 }
 

Modified: trunk/varnish-cache/bin/varnishd/cli_event.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cli_event.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/cli_event.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -105,16 +105,17 @@
 		sbuf_finish(cli->sb);
 		/* XXX: syslog results ? */
 		encode_output(cli);
-		bufferevent_enable(cli->bev1, EV_WRITE);
+		AZ(bufferevent_enable(cli->bev1, EV_WRITE));
 	}
 }
 
 static void
-wrcb(struct bufferevent *bev __unused, void *arg)
+wrcb(struct bufferevent *bev, void *arg)
 {
 	struct cli *cli = arg;
 
-	bufferevent_disable(cli->bev1, EV_WRITE);
+	(void)bev;
+	AZ(bufferevent_disable(cli->bev1, EV_WRITE));
 }
 
 static void
@@ -133,20 +134,20 @@
 
 	cli->bev0 = bufferevent_new(fdr, rdcb, wrcb, excb, cli);
 	assert(cli->bev0 != NULL);
-	bufferevent_base_set(eb, cli->bev0);
+	AZ(bufferevent_base_set(eb, cli->bev0));
 	if (fdr == fdw)
 		cli->bev1 = cli->bev0;
 	else 
 		cli->bev1 = bufferevent_new(fdw, rdcb, wrcb, excb, cli);
 	assert(cli->bev1 != NULL);
-	bufferevent_base_set(eb, cli->bev1);
+	AZ(bufferevent_base_set(eb, cli->bev1));
 	cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND);
 	assert(cli->sb != NULL);
 
 	cli->verbose = ver;
 	cli->cli_proto = cli_proto;
 	
-	bufferevent_enable(cli->bev0, EV_READ);
+	AZ(bufferevent_enable(cli->bev0, EV_READ));
 	return (cli);
 }
 
@@ -155,7 +156,7 @@
 {
 
 	cli->suspend = 1;
-	bufferevent_disable(cli->bev0, EV_READ);
+	AZ(bufferevent_disable(cli->bev0, EV_READ));
 }
 
 void
@@ -164,8 +165,8 @@
 	sbuf_finish(cli->sb);
 	/* XXX: syslog results ? */
 	encode_output(cli);
-	bufferevent_enable(cli->bev1, EV_WRITE);
+	AZ(bufferevent_enable(cli->bev1, EV_WRITE));
 	cli->suspend = 0;
-	bufferevent_enable(cli->bev0, EV_READ);
+	AZ(bufferevent_enable(cli->bev0, EV_READ));
 }
 

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2006-07-12 23:30:49 UTC (rev 466)
@@ -8,6 +8,7 @@
 -e728	// Symbol ... not explicitly initialized
 -e716	// while(1) ... 
 -e785	// Too few initializers for aggregate 
+-e786	// String concatenation within initializer
 
 -emacro(740, TAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
 -emacro((826), TAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
@@ -17,6 +18,8 @@
 -esym(534, fprintf)	// Ignoring return value of function
 -esym(534, memset)	// Ignoring return value of function
 -esym(534, memcpy)	// Ignoring return value of function
+-esym(534, memmove)	// Ignoring return value of function
+-esym(534, strcpy)	// Ignoring return value of function
 -esym(534, sbuf_printf)	// Ignoring return value of function
 -esym(534, sbuf_cat)	// Ignoring return value of function
 
@@ -31,48 +34,19 @@
 -esym(528, vcl_handlingname)	// Not referenced
 -e641	// Converting enum 'cli_status_e' to int
 
-// storage_file.c
+// Review all below this line ///////////////////////////////////////////////
 
-// Review all below this line
-
-// -printf_code( H, void *, unsigned)
-// -printf_code( ju, long long unsigned)
-// -printf_code( jx, long long unsigned)
-// 
-
 -e767	// Macro redef (system queue.h vs ours )
 
 -e574	// Signed-unsigned mix with relational
 -e712	// Loss of precision (assignment) (long long to
 -e747	// Significant prototype coercion (arg. no. 2) long
 -e713	// Loss of precision (assignment) (unsigned long long to long long)
+-e506	// Constant value boolean
+-e818	// Pointer parameter '...' could be declared as pointing to const
+-e774	// Boolean within 'if' always evaluates to False
+-e534	// Ignoring return value of function
+-e557	// unrecog format
+-e732   // Loss of sign (arg. no. 2) (int to unsigned
+-e737	// [45]  Loss of sign in promotion from int to unsigned
 
-// 
-// 
--e737	//  Loss of sign in promotion from int to unsigned int
--e732	// Loss of sign (arg. no. 2) (int to unsigned int)
-// -e715	// Symbol 'arg' (line 43) not referenced
-// -e818	// Pointer parameter '...' could be declared as pointing to const
-// 
-// -e534	// Ignoring return value of function
-// -e767	// macro 'LIST_INIT' was defined differently
-// 
-// -e506	// Constant value boolean
-// -e527	// Unreachable code at token 'return'
-// -e774	// Boolean within 'if' always evaluates to False
-// 
-// -e525	// Negative indentation from line 90
-// -e539	// Did not expect positive indentation
-// -e725	// Expected positive indentation from line 136
-// -e734	// Loss of precision (assignment) (31 bits to 8 bits)
-// 
-// 
-// 
-// -e766	//  Header file '../../include/libvarnish.h' not used in module
-// 
-// -e773	// Expression-like macro 'VCL_FARGS' not parenthesized
-// 
-// -e788	// enum constant 'HND_Unclass' not used within defaulted switch
-// 
-// 
-// -e786	// String concatenation within initializer

Modified: trunk/varnish-cache/bin/varnishd/flint.sh
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.sh	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/flint.sh	2006-07-12 23:30:49 UTC (rev 466)
@@ -1,9 +1,30 @@
 #!/bin/sh
 
+T=/tmp/_$$
 flexelint \
 	-I/usr/include \
 	-I. \
 	-I../../include \
 	-I../../contrib/libevent \
 	flint.lnt \
-	*.c
+	*.c > $T 2>&1
+
+for t in Error Warning Info
+do
+	sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T
+done | awk '
+$2 == 830	{ next }
+$2 == 831	{ next }
+	{
+	i=$2"_"$1
+	h[i]++
+	n++
+	}
+END	{
+	printf "%5d %s\n", n, "Total"
+	for (i in h)
+		printf "%5d %s\n", h[i], i
+	}
+' | sort -rn
+
+cat $T

Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -78,6 +78,8 @@
 	time_t h_date, h_expires, ttd;
 	char *p;
 	
+	(void)t_resp;	/* XXX */
+
 	retirement_age = INT_MAX;
 
 	u1 = u2 = 0;

Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -69,8 +69,8 @@
 	if (loghead->ptr + 4 + l + 1 > loghead->size)
 		vsl_wrap();
 	p = logstart + loghead->ptr;
-	p[1] = l;
-	p[2] = id >> 8;
+	p[1] = l & 0xff;
+	p[2] = (id >> 8) & 0xff;
 	p[3] = id & 0xff;
 	memcpy(p + 4, b, l);
 	p[4 + l] = SLT_ENDMARKER;

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-12 22:52:08 UTC (rev 465)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-12 23:30:49 UTC (rev 466)
@@ -91,10 +91,11 @@
 }
 
 static void
-m_cli_func_passthrough(struct cli *cli, char **av, void *priv __unused)
+m_cli_func_passthrough(struct cli *cli, char **av, void *priv)
 {
 
 	(void)av;
+	(void)priv;
 
 	cli_suspend(cli);
 	mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]);
@@ -277,7 +278,7 @@
 	if (av[2] != NULL) {
 		cli_out(cli, "Got your %s\n", av[2]);
 	} 
-	time(&t);
+	t = time(NULL);
 	cli_out(cli, "PONG %ld\n", t);
 }
 
@@ -340,8 +341,8 @@
 	cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto);
 
 	signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL);
-	event_base_set(mgt_eb, &e_sigchld);
-	signal_add(&e_sigchld, NULL);
+	AZ(event_base_set(mgt_eb, &e_sigchld));
+	AZ(signal_add(&e_sigchld, NULL));
 
 	mgt_child_start();
 
@@ -505,7 +506,7 @@
 	const char *sflag = "file";
 	const char *hflag = "classic";
 
-	register_printf_render_std((const unsigned char *)"HVQ");
+	(void)register_printf_render_std((const unsigned char *)"HVQ");
 
 	setbuf(stdout, NULL);
 	setbuf(stderr, NULL);




More information about the varnish-commit mailing list