From 14e9b0fdbfd4bca452c7e94137ddf40ec572b4c3 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Sun, 9 Dec 2001 13:09:14 +0000 Subject: Use queue.h TAILQ macros instead of accessing members directly. (And convert a few loops to TAILQ_FOREACH). --- sys/net/if_arcsubr.c | 6 +++--- sys/net/if_atmsubr.c | 8 ++++---- sys/net/if_ethersubr.c | 9 ++++----- sys/net/if_tokensubr.c | 6 +++--- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'sys/net') diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 08675f34879..6545e38c025 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_arcsubr.c,v 1.7 2001/06/15 03:38:33 itojun Exp $ */ +/* $OpenBSD: if_arcsubr.c,v 1.8 2001/12/09 13:09:13 jason Exp $ */ /* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */ /* @@ -562,8 +562,7 @@ arc_ifattach(ifp) log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n", ifp->if_xname, ifp->if_xname); } - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && sdl->sdl_family == AF_LINK) { sdl->sdl_type = IFT_ARCNET; @@ -572,4 +571,5 @@ arc_ifattach(ifp) LLADDR(sdl), ifp->if_addrlen); break; } + } } diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index 10c13bbbb73..fa6bde0695b 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atmsubr.c,v 1.16 2001/06/27 06:07:38 kjc Exp $ */ +/* $OpenBSD: if_atmsubr.c,v 1.17 2001/12/09 13:09:13 jason Exp $ */ /* * @@ -359,10 +359,9 @@ atm_ifattach(ifp) ifp->if_output = atm_output; #if defined(__NetBSD__) || defined(__OpenBSD__) - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { #elif defined(__FreeBSD__) || defined(__bsdi__) - for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) { #endif if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && @@ -374,4 +373,5 @@ atm_ifattach(ifp) #endif break; } + } } diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 60a0dcdcb26..d3d08096f39 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.59 2001/11/30 07:59:17 itojun Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.60 2001/12/09 13:09:13 jason Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -367,7 +367,7 @@ ether_output(ifp, m0, dst, rt0) */ aa = (struct at_ifaddr *)at_ifawithnet( (struct sockaddr_at *)dst, - ifp->if_addrlist.tqh_first); + TAILQ_FIRST(&ifp->if_addrlist)); if (aa == 0) goto bad; @@ -722,12 +722,11 @@ ether_input(ifp, eh, m) struct ifaddr *ifa; struct sockaddr_dl *sdl = NULL; - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && sdl->sdl_family == AF_LINK) break; - + } /* * If this is not a simplex interface, drop the packet * if it came from us. diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c index 8b745ca24e6..e039960fa36 100644 --- a/sys/net/if_tokensubr.c +++ b/sys/net/if_tokensubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tokensubr.c,v 1.4 2001/06/27 06:07:45 kjc Exp $ */ +/* $OpenBSD: if_tokensubr.c,v 1.5 2001/12/09 13:09:13 jason Exp $ */ /* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */ /* @@ -694,8 +694,7 @@ token_ifattach(ifp) #ifdef IFF_NOTRAILERS ifp->if_flags |= IFF_NOTRAILERS; #endif - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && sdl->sdl_family == AF_LINK) { sdl->sdl_type = IFT_ISO88025; @@ -704,4 +703,5 @@ token_ifattach(ifp) LLADDR(sdl), ifp->if_addrlen); break; } + } } -- cgit v1.2.3