[patch] fix warning in ipaddress.c

Bernhard Fischer rep.nop at aon.at
Wed May 17 11:39:46 UTC 2006


On Wed, May 17, 2006 at 01:07:20PM +0200, Bernhard Fischer wrote:
>On Wed, May 17, 2006 at 12:25:14PM +0200, walter harms wrote:

>>>>hi list,
>>>>this patch fixes:
>>>>In function `ipaddr_list_or_flush':
>>>>warning: declaration of `round' shadows a global declaration
>>>>
>>>>and removes an '#if 0' statement
>>>>
>>>>re,
>>>>  wh

>
>I'm a little bit irritated by your change..
>If i read this right, then you rename an unused variable instead of
>removing it. Why aren't you removing it completely?
>
>Please clarify.
>TIA,
>Bernhard

To outline what i mean, what's the value of printing that error (i
really do not know)?

What about the attached untested snippet?


-------------- next part --------------
Index: networking/libiproute/ipaddress.c
===================================================================
--- networking/libiproute/ipaddress.c	(revision 15006)
+++ networking/libiproute/ipaddress.c	(working copy)
@@ -506,7 +506,6 @@ int ipaddr_list_or_flush(int argc, char 
 	}
 
 	if (flush) {
-		int round = 0;
 		char flushb[4096-512];
 
 		filter.flushb = flushb;
@@ -525,14 +524,9 @@ int ipaddr_list_or_flush(int argc, char 
 				exit(1);
 			}
 			if (filter.flushed == 0) {
-#if 0
-				if (round == 0)
-					fprintf(stderr, "Nothing to flush.\n");
-#endif
 				fflush(stdout);
 				return 0;
 			}
-			round++;
 			if (flush_update() < 0)
 				exit(1);
 		}
Index: networking/libiproute/iproute.c
===================================================================
--- networking/libiproute/iproute.c	(revision 15006)
+++ networking/libiproute/iproute.c	(working copy)
@@ -588,7 +588,6 @@ static int iproute_list_or_flush(int arg
 	}
 
 	if (flush) {
-		int _round = 0;
 		char flushb[4096-512];
 
 		if (filter.tb == -1) {
@@ -614,14 +613,9 @@ static int iproute_list_or_flush(int arg
 				return -1;
 			}
 			if (filter.flushed == 0) {
-				if (_round == 0) {
-					if (filter.tb != -1 || do_ipv6 == AF_INET6)
-						fprintf(stderr, "Nothing to flush.\n");
-				}
 				fflush(stdout);
 				return 0;
 			}
-			_round++;
 			if (flush_update() < 0)
 				exit(1);
 		}


More information about the busybox mailing list