[master] d9a700c Rewrite this slightly to avoid 16 "constant value boolean) warnings from FlexeLint.

Poul-Henning Kamp phk at FreeBSD.org
Mon Mar 16 21:20:24 CET 2015


commit d9a700c2f9c9689e26ca6a0644eeae989d27a3c3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 16 20:19:55 2015 +0000

    Rewrite this slightly to avoid 16 "constant value boolean) warnings
    from FlexeLint.

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 3a478a3..0326036 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -309,22 +309,26 @@ SES_Wait(struct sess *sp)
  * assuming that the approximation of non-atomic global counters is sufficient.
  * if not: update to per-wrk
  */
+
 static void
 ses_close_acct(enum sess_close reason)
 {
+	int i = 0;
+
 	assert(reason != SC_NULL);
 	switch (reason) {
 #define SESS_CLOSE(reason, stat, err, desc)		\
 	case SC_ ## reason:				\
 		VSC_C_main->sc_ ## stat++;		\
-		if (err)				\
-			VSC_C_main->sess_closed_err++;	\
+		i = err;				\
 		break;
 #include "tbl/sess_close.h"
 #undef SESS_CLOSE
 	default:
 		WRONG("Wrong event in ses_close_acct");
 	}
+	if (i)
+		VSC_C_main->sess_closed_err++;
 }
 
 /*--------------------------------------------------------------------



More information about the varnish-commit mailing list