Skip to contentSkip to conversation

Remove compile warnings from ipv4/raw.c and ipv4/arp.c

PATCH New Bob Miller 1 participant 1 message Dec 11, 2002

Subsystems (2)
lore
Share & tools
lore

Bob Miller

author
#0 lore raw

PATCH 1/1 Remove compile warnings from ipv4/raw.c and ipv4/arp.c

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.

net/ipv4/arp.c +11 -11
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
@@ -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;
 }
 
net/ipv4/raw.c +11 -8
diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c
@@ -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;
 }
Signature · 2 lines
Bob Miller					Email: [email protected]
Open Source Development Lab			Phone: 503.626.2455 Ext. 17