summaryrefslogtreecommitdiff
path: root/sys/netatalk/at_control.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-11-13 15:07:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-11-13 15:07:24 +0000
commit7fd99c4223ef66697195f7c350bbd2db5035aad1 (patch)
tree680fbec6d5d489f4cfdd6783bf5a066ff30f8979 /sys/netatalk/at_control.c
parent32e887a25e9cf2c0addbd3c7c3df3d12302770dc (diff)
Use TAILQ_ macros instead of handrolling them self. Tested by myself.
Diffstat (limited to 'sys/netatalk/at_control.c')
-rw-r--r--sys/netatalk/at_control.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c
index 91f1900fc93..4f9f371d71b 100644
--- a/sys/netatalk/at_control.c
+++ b/sys/netatalk/at_control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at_control.c,v 1.13 2008/06/08 19:10:33 claudio Exp $ */
+/* $OpenBSD: at_control.c,v 1.14 2009/11/13 15:07:23 claudio Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -113,7 +113,7 @@ at_control( cmd, data, ifp, p )
struct at_aliasreq *ifra = (struct at_aliasreq *)data;
struct at_ifaddr *aa0;
struct at_ifaddr *aa = 0;
- struct ifaddr *ifa, *ifa0;
+ struct ifaddr *ifa0;
if ( ifp ) {
for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
@@ -190,14 +190,7 @@ at_control( cmd, data, ifp, p )
aa = aa0;
- if (( ifa = ifp->if_addrlist.tqh_first ) != NULL ) {
- for ( ; ifa->ifa_list.tqe_next; ifa = ifa->ifa_list.tqe_next )
- ;
- ifa->ifa_list.tqe_next = (struct ifaddr *)aa;
- } else {
- ifp->if_addrlist.tqh_first = (struct ifaddr *)aa;
- }
-
+ TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)aa, ifa_list);
/* FreeBSD found this. Whew */
aa->aa_ifa.ifa_refcnt++;
@@ -265,19 +258,7 @@ at_control( cmd, data, ifp, p )
case SIOCDIFADDR:
at_scrub( ifp, aa );
ifa0 = (struct ifaddr *)aa;
- if (( ifa = ifp->if_addrlist.tqh_first ) == ifa0 ) {
- ifp->if_addrlist.tqh_first = ifa->ifa_list.tqe_next;
- } else {
- while ( ifa->ifa_list.tqe_next &&
- ( ifa->ifa_list.tqe_next != ifa0 )) {
- ifa = ifa->ifa_list.tqe_next;
- }
- if ( ifa->ifa_list.tqe_next ) {
- ifa->ifa_list.tqe_next = ifa0->ifa_list.tqe_next;
- } else {
- panic( "at_control" );
- }
- }
+ TAILQ_REMOVE(&ifp->if_addrlist, ifa0, ifa_list);
/* FreeBSD */
IFAFREE(ifa0);