netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] devinet: cleanup if statements
@ 2005-06-07 20:32 pmeda
  2005-06-21 20:48 ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: pmeda @ 2005-06-07 20:32 UTC (permalink / raw)
  To: davem, jgarzik; +Cc: akpm, netdev


Cleanup the devinet if statements.
 - when there is no colon, interface name is same as device.
 - ifa_label is an array, not a pointer, and so can never be null.

Signed-Off-by: Prasanna Meda <pmeda@akamai.com>

--- a/net/ipv4/devinet.c	Wed Jun  1 23:54:37 2005
+++ b/net/ipv4/devinet.c	Wed Jun  1 23:57:16 2005
@@ -636,10 +636,7 @@
 			ret = -ENOBUFS;
 			if ((ifa = inet_alloc_ifa()) == NULL)
 				break;
-			if (colon)
-				memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
-			else
-				memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
+			memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
 		} else {
 			ret = 0;
 			if (ifa->ifa_local == sin->sin_addr.s_addr)
@@ -746,10 +743,7 @@
 		if (len < (int) sizeof(ifr))
 			break;
 		memset(&ifr, 0, sizeof(struct ifreq));
-		if (ifa->ifa_label)
-			strcpy(ifr.ifr_name, ifa->ifa_label);
-		else
-			strcpy(ifr.ifr_name, dev->name);
+		strcpy(ifr.ifr_name, ifa->ifa_label);
 
 		(*(struct sockaddr_in *)&ifr.ifr_addr).sin_family = AF_INET;
 		(*(struct sockaddr_in *)&ifr.ifr_addr).sin_addr.s_addr =

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-23 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-07 20:32 [patch] devinet: cleanup if statements pmeda
2005-06-21 20:48 ` David S. Miller
2005-06-21 21:51   ` Andi Kleen
2005-06-23 11:38   ` Herbert Xu
2005-06-23 18:13     ` Prasanna Meda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).