[Swan-dev] clanger: read_foodgroup

D. Hugh Redelmeier hugh at mimosa.com
Sun Jun 10 20:51:39 UTC 2018


clang gave warnings near programs/pluto/foodgroups.c.
They are about redundant assignments to r.  In itself, a redundant
assignment isn't a bug.  But it often indicates some kind of mistake.
So I added some ??? comments.

Does anyone know the intent?  Paul?

--- a/programs/pluto/foodgroups.c
+++ b/programs/pluto/foodgroups.c
@@ -238,12 +238,13 @@ static void read_foodgroup(struct fg_groups *g)
 							break;
 
 						if (proto == (*pp)->proto && sport == (*pp)->sport && dport == (*pp)->dport) {
+							/* ??? we know that r == 0: why set it again? */
 							r = 0;
 							break;
 						} else {
+							/* ??? since we are looping, r's value won't be used */
 							r = 1;
 						}


More information about the Swan-dev mailing list