r463 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 13 00:01:43 CEST 2006


Author: phk
Date: 2006-07-13 00:01:43 +0200 (Thu, 13 Jul 2006)
New Revision: 463

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Give this file a flexelinting


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-07-12 22:01:15 UTC (rev 462)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-07-12 22:01:43 UTC (rev 463)
@@ -20,7 +20,6 @@
 #include <sbuf.h>
 
 #include "config.h"
-#include "compat.h"
 #include "libvarnish.h"
 #include "heritage.h"
 #include "shmlog.h"
@@ -72,7 +71,7 @@
 }
 
 static void
-vca_delete_sess(struct sess *sp)
+vca_delete_sess(const struct sess *sp)
 {
 
 	VSL_stats->n_sess--;
@@ -160,13 +159,16 @@
 /*--------------------------------------------------------------------*/
 
 static void
-vca_tick(int a __unused, short b __unused, void *c __unused)
+vca_tick(int a, short b, void *c)
 {
 	struct sess *sp, *sp2;
 	time_t t;
 
-	evtimer_add(&tick_e, &tick_rate);
-	time(&t);
+	(void)a;
+	(void)b;
+	(void)c;
+	AZ(evtimer_add(&tick_e, &tick_rate));
+	(void)time(&t);
 	TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) {
 		if (sp->t_resp + 30 < t) {
 			TAILQ_REMOVE(&sesshead, sp, list);
@@ -194,20 +196,22 @@
 }
 
 static void
-pipe_f(int fd, short event __unused, void *arg __unused)
+pipe_f(int fd, short event, void *arg)
 {
 	struct sess *sp;
 	int i;
 
+	(void)event;
+	(void)arg;
 	i = read(fd, &sp, sizeof sp);
 	assert(i == sizeof sp);
-	time(&sp->t_resp);
+	sp->t_resp = time(NULL);
 	TAILQ_INSERT_TAIL(&sesshead, sp, list);
 	http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp);
 }
 
 static void
-accept_f(int fd, short event __unused, void *arg __unused)
+accept_f(int fd, short event, void *arg)
 {
 	socklen_t l;
 	struct sockaddr addr[2];	/* XXX: IPv6 hack */
@@ -215,6 +219,8 @@
 	int i;
 	struct linger linger;
 
+	(void)event;
+	(void)arg;
 	VSL_stats->client_conn++;
 
 	sp = vca_new_sess();
@@ -239,28 +245,31 @@
 
 	TCP_name(addr, l, sp->addr);
 	VSL(SLT_SessionOpen, sp->fd, "%s", sp->addr);
-	time(&sp->t_resp);
+	(void)time(&sp->t_resp);
 	TAILQ_INSERT_TAIL(&sesshead, sp, list);
 	http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp);
 }
 
 static void *
-vca_main(void *arg __unused)
+vca_main(void *arg)
 {
 	unsigned u;
 	struct event *ep;
 
+	(void)arg;
+
 	AZ(pipe(pipes));
 	evb = event_init();
+	assert(evb != NULL);
 
 	event_set(&pipe_e, pipes[0], EV_READ | EV_PERSIST, pipe_f, NULL);
-	event_base_set(evb, &pipe_e);
-	event_add(&pipe_e, NULL);
+	AZ(event_base_set(evb, &pipe_e));
+	AZ(event_add(&pipe_e, NULL));
 
 	evtimer_set(&tick_e, vca_tick, NULL);
-	event_base_set(evb, &tick_e);
+	AZ(event_base_set(evb, &tick_e));
 	
-	evtimer_add(&tick_e, &tick_rate);
+	AZ(evtimer_add(&tick_e, &tick_rate));
 
 	ep = accept_e;
 	for (u = 0; u < HERITAGE_NSOCKS; u++) {
@@ -268,23 +277,22 @@
 			event_set(ep, heritage.sock_local[u],
 			    EV_READ | EV_PERSIST,
 			    accept_f, NULL);
-			event_base_set(evb, ep);
-			event_add(ep, NULL);
+			AZ(event_base_set(evb, ep));
+			AZ(event_add(ep, NULL));
 			ep++;
 		}
 		if (heritage.sock_remote[u] >= 0) {
 			event_set(ep, heritage.sock_remote[u],
 			    EV_READ | EV_PERSIST,
 			    accept_f, NULL);
-			event_base_set(evb, ep);
-			event_add(ep, NULL);
+			AZ(event_base_set(evb, ep));
+			AZ(event_add(ep, NULL));
 			ep++;
 		}
 	}
 
-	event_base_loop(evb, 0);
-	assert(0 == 1);
-	return (NULL);
+	AZ(event_base_loop(evb, 0));
+	INCOMPL();
 }
 
 /*--------------------------------------------------------------------*/
@@ -294,7 +302,8 @@
 {
 
 	VSL(SLT_SessionClose, sp->fd, why);
-	close(sp->fd);
+	if (sp->fd >= 0)
+		AZ(close(sp->fd));
 	sp->fd = -1;
 }
 
@@ -306,7 +315,7 @@
 
 	if (sp->fd >= 0) {
 		VSL(SLT_SessionReuse, sp->fd, "%s", sp->addr);
-		write(pipes[1], &sp, sizeof sp);
+		assert(sizeof sp == write(pipes[1], &sp, sizeof sp));
 	} else {
 		vca_delete_sess(sp);
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2006-07-12 22:01:15 UTC (rev 462)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2006-07-12 22:01:43 UTC (rev 463)
@@ -199,7 +199,6 @@
 
 	TCP_myname(s, buf);
 	p = strchr(buf, '\0');
-	assert(p != NULL);
 	*p++ = ' ';
 	TCP_name(ai->ai_addr, ai->ai_addrlen, p);
 	VSL(SLT_BackendOpen, s, buf);

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2006-07-12 22:01:15 UTC (rev 462)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2006-07-12 22:01:43 UTC (rev 463)
@@ -1,47 +1,64 @@
 -passes=3
 
-// Review all below this line
+// Fix strchr() semtics, it can only return NULL if arg2 != 0
+-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
 
--printf_code( H, void *, unsigned)
--printf_code( ju, long long unsigned)
--printf_code( jx, long long unsigned)
-
 -e763	// Redundant declaration for symbol '...' previously declared
+-e726	// Extraneous comma ignored
+-e728	// Symbol ... not explicitly initialized
 
+-esym(534, fprintf)	// Ignoring return value of function
+-esym(534, memset)	// Ignoring return value of function
+-esym(534, sbuf_printf)	// Ignoring return value of function
 
--e737	//  Loss of sign in promotion from int to unsigned int
--e715	// Symbol 'arg' (line 43) not referenced
--e818	// Pointer parameter '...' could be declared as pointing to const
+// cache.h
+-emacro(506, INCOMPL) // Constant value Boolean
 
--e534	// Ignoring return value of function
--e767	// macro 'LIST_INIT' was defined differently
+// cache_vcl.c
+-efunc(525, vcl_handlingname)	// Negative indentation from line
+-esym(528, vcl_handlingname)	// Not referenced
+-e641	// Converting enum 'cli_status_e' to int
 
--e506	// Constant value boolean
--e527	// Unreachable code at token 'return'
--e732	// Loss of sign (arg. no. 2) (int to unsigned int)
--e774	// Boolean within 'if' always evaluates to False
--e713	// Loss of precision (assignment) (unsigned long long to long long)
--e574	// Signed-unsigned mix with relational
+// Review all below this line
 
--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)
--e747	// Significant prototype coercion (arg. no. 2) long
--e712	// Loss of precision (assignment) (long long to
+// -printf_code( H, void *, unsigned)
+// -printf_code( ju, long long unsigned)
+// -printf_code( jx, long long unsigned)
+// 
 
 
--e785	// Too few initializers for aggregate 
-
--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
-
--e716	// while(1) ... 
--e641	// Converting enum 'cli_status_e' to int
-
--e786	// String concatenation within initializer
-
--emacro(19, MAC_STAT)	// Useless Declaration
+// 
+// 
+-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
+// -e713	// Loss of precision (assignment) (unsigned long long to long long)
+// -e574	// Signed-unsigned mix with relational
+// 
+// -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)
+// -e747	// Significant prototype coercion (arg. no. 2) long
+// -e712	// Loss of precision (assignment) (long long to
+// 
+// 
+// -e785	// Too few initializers for aggregate 
+// 
+// -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
+// 
+// -e716	// while(1) ... 
+// 
+// -e786	// String concatenation within initializer

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-12 22:01:15 UTC (rev 462)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-12 22:01:43 UTC (rev 463)
@@ -122,6 +122,7 @@
 		q = p + 1;
 	} else {
 		p = strchr(bflag, '\0');
+		assert(p != NULL);
 		q = "http";
 	}
 	




More information about the varnish-commit mailing list