[master] 575197f Initialize a variable

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Dec 11 22:54:10 UTC 2017


commit 575197f24eca6ed4399032b7efbed9ecb0697fea
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Dec 11 23:51:39 2017 +0100

    Initialize a variable
    
    Otherwise some compilers *cough* GCC *cough* may fail to see that it's
    properly written before any read.

diff --git a/lib/libvarnish/binary_heap.c b/lib/libvarnish/binary_heap.c
index 88c85d4..b49f9d6 100644
--- a/lib/libvarnish/binary_heap.c
+++ b/lib/libvarnish/binary_heap.c
@@ -520,14 +520,12 @@ chk2(struct binheap *bh)
 #endif
 
 int
-main(int argc, char **argv)
+main(void)
 {
 	struct binheap *bh;
 	unsigned j, u, v, lr, n;
 	struct foo *fp;
 
-	(void)argc;
-	(void)argv;
 	VRND_SeedAll();
 	VRND_SeedTestable(1);
 	bh = binheap_new(NULL, cmp, update);
@@ -537,6 +535,8 @@ main(int argc, char **argv)
 		child(bh, n + 1, &u, &v);
 	}
 
+	lr = 0; /* unconfuse some compilers... */
+
 	for (j = 0; j < 2; j++) {
 		/* First insert our N elements */
 		for (u = 0; u < N; u++) {
@@ -614,7 +614,7 @@ main(int argc, char **argv)
 				AN(ff[v]->idx);
 			}
 #ifdef CHECK2
-				chk2(bh);
+			chk2(bh);
 #endif
 		}
 		fprintf(stderr, "%d updates OK\n", M);


More information about the varnish-commit mailing list