From ad73c2e5edbff544f573e49c032ef7d72fac8b57 Mon Sep 17 00:00:00 2001 From: itojun Date: Wed, 6 Oct 2004 03:48:19 +0000 Subject: [PATCH] remove unneeded loop, use ifunit() --- freebsd4/sys/net/if.c | 8 +------- freebsd5/sys/net/if.c | 8 +------- netbsd/sys/net/if.c | 8 +------- openbsd/sys/net/if.c | 8 +------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/freebsd4/sys/net/if.c b/freebsd4/sys/net/if.c index 1c1d2b51e8..9aa8d63e64 100644 --- a/freebsd4/sys/net/if.c +++ b/freebsd4/sys/net/if.c @@ -518,7 +518,6 @@ if_clone_create(name, len) int len; { struct if_clone *ifc; - struct ifnet *ifp; char *dp; int wildcard; int unit; @@ -554,12 +553,7 @@ if_clone_create(name, len) } s = splimp(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { - if (ifp == ifunit(name)) { - if_attachdomain1(ifp); - break; - } - } + if_attachdomain1(ifunit(name)); splx(s); return (0); diff --git a/freebsd5/sys/net/if.c b/freebsd5/sys/net/if.c index 3255a6d573..d86989332d 100644 --- a/freebsd5/sys/net/if.c +++ b/freebsd5/sys/net/if.c @@ -668,7 +668,6 @@ int if_clone_create(char *name, int len) { struct if_clone *ifc; - struct ifnet *ifp; char *dp; int wildcard, bytoff, bitoff; int unit; @@ -733,12 +732,7 @@ if_clone_create(char *name, int len) } s = splimp(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { - if (ifp == ifunit(name)) { - if_attachdomain1(ifp); - break; - } - } + if_attachdomain1(ifunit(name)); splx(s); return (0); diff --git a/netbsd/sys/net/if.c b/netbsd/sys/net/if.c index 4066580260..1867975578 100644 --- a/netbsd/sys/net/if.c +++ b/netbsd/sys/net/if.c @@ -750,7 +750,6 @@ if_clone_create(name) const char *name; { struct if_clone *ifc; - struct ifnet *ifp; int unit; int error; int s; @@ -767,12 +766,7 @@ if_clone_create(name) return (error); s = splnet(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { - if (strcmp(name, ifp->if_xname) == 0) { - if_attachdomain1(ifp); - break; - } - } + if_attachdomain1(ifunit(name)); splx(s); return (error); diff --git a/openbsd/sys/net/if.c b/openbsd/sys/net/if.c index 0ae5037e0c..c662820651 100644 --- a/openbsd/sys/net/if.c +++ b/openbsd/sys/net/if.c @@ -635,7 +635,6 @@ if_clone_create(name) const char *name; { struct if_clone *ifc; - struct ifnet *ifp; int unit; int error; int s; @@ -652,12 +651,7 @@ if_clone_create(name) return (error); s = splnet(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { - if (strcmp(name, ifp->if_xname) == 0) { - if_attachdomain1(ifp); - break; - } - } + if_attachdomain1(ifunit(name)); splx(s); return (error);