[master] 7a385e9 Strictly speaking

Poul-Henning Kamp phk at FreeBSD.org
Tue Aug 12 10:29:33 CEST 2014


commit 7a385e94959f8210a504746be10adf055aa6c4b2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Aug 12 08:27:54 2014 +0000

    Strictly speaking
    
    	int
    	foo()
    	{
    		int bar;
    
    		(void)bar;
    		[...]
    	}
    
    Isn't valid C because bar has an undefined value when you cast its
    value away.  Yes, many thanks to ISO-C for that gem.
    
    Memset the variables to zero instead.

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index af86b2b..7afcef6 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -131,8 +131,8 @@ vca_tcp_opt_init(void)
 	int chg = 0;
 	int x;
 
-	(void)tv;
-	(void)x;
+	memset(&tv, 0, sizeof tv);
+	memset(&x, 0, sizeof x);
 
 	for (n = 0; n < n_tcp_opts; n++) {
 		to = &tcp_opts[n];



More information about the varnish-commit mailing list