All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.5.51] Remove compile warnings from ipv4/raw.c and ipv4/arp.c
@ 2002-12-11 22:32 Bob Miller
  0 siblings, 0 replies; only message in thread
From: Bob Miller @ 2002-12-11 22:32 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

Recoded a couple of routines (neigh_get_next()/raw_get_next()) to remove
goto's jumping back into the middle of do {} while(); loop.  This removes the 

    warning: deprecated use of label at end of compound statement

from these two files.


diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c	Wed Dec 11 13:41:51 2002
+++ b/net/ipv4/arp.c	Wed Dec 11 13:41:51 2002
@@ -1168,19 +1168,19 @@
 {
 	struct arp_iter_state* state = seq->private;
 
-	do {
-		n = n->next;
+	n = n->next;
+	while (n != NULL) {
 		/* Don't confuse "arp -a" w/ magic entries */
-try_again:
-	} while (n && !(n->nud_state & ~NUD_NOARP));
+		if ((n->nud_state == 0) || (n->nud_state == NUD_NOARP)) {
+			n = n->next;
+		} else {
+			if (++state->bucket > NEIGH_HASHMASK) {
+				break;
+			}
+			n = arp_tbl.hash_buckets[state->bucket];
+		}
+	}
 
-	if (n)
-		goto out;
-	if (++state->bucket > NEIGH_HASHMASK)
-		goto out;
-	n = arp_tbl.hash_buckets[state->bucket];
-	goto try_again;
-out:
 	return n;
 }
 
diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c	Wed Dec 11 13:41:51 2002
+++ b/net/ipv4/raw.c	Wed Dec 11 13:41:51 2002
@@ -712,14 +712,17 @@
 {
 	struct raw_iter_state* state = raw_seq_private(seq);
 
-	do {
-		sk = sk->next;
-try_again:
-	} while (sk && sk->family != PF_INET);
-
-	if (!sk && ++state->bucket < RAWV4_HTABLE_SIZE) {
-		sk = raw_v4_htable[state->bucket];
-		goto try_again;
+	sk = sk->next;
+	while (sk != NULL) {
+		if (sk->family == PF_INET) {
+			if (++state->bucket < RAWV4_HTABLE_SIZE) {
+				sk = raw_v4_htable[state->bucket];
+			} else {
+				break;
+			}
+		} else {
+			sk = sk->next;
+		}
 	}
 	return sk;
 }
-- 
Bob Miller					Email: rem@osdl.org
Open Source Development Lab			Phone: 503.626.2455 Ext. 17

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-11 22:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-11 22:32 [PATCH 2.5.51] Remove compile warnings from ipv4/raw.c and ipv4/arp.c Bob Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.