Don't open-code queue(3) macros (x = ifnet.tqh_first; y =

x.if_list.tqe_next).  Instead, use the macros themselves.
This commit is contained in:
dyoung 2007-12-05 01:02:15 +00:00
parent 769f8347e5
commit 3f6c5b6545
2 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ether_bpf.c,v 1.7 2007/10/17 19:54:59 garbled Exp $ */
/* $NetBSD: ether_bpf.c,v 1.8 2007/12/05 01:02:15 dyoung Exp $ */
/*
* Copyright (c) 1998
@ -34,6 +34,7 @@
#include <stdlib.h>
#include <limits.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/bpf.h>
@ -125,15 +126,15 @@ int EtherInit(ha)
}
kvm_read(kvm, nl[0].n_value, &ifh, sizeof(struct ifnet_head));
ifp = ifh.tqh_first;
ifp = TAILQ_FIRST(&ifh);
while (ifp) {
struct ifnet ifnet;
kvm_read(kvm, (u_long)ifp, &ifnet, sizeof(struct ifnet));
if (!strcmp(ifnet.if_xname, BPF_IFNAME)) {
ifap = ifnet.if_addrlist.tqh_first;
ifap = TAILQ_FIRST(&ifnet.if_addrlist);
break;
}
ifp = ifnet.if_list.tqe_next;
ifp = TAILQ_NEXT(&ifnet, if_list);
}
if (!ifp) {
warnx("interface not found");
@ -154,7 +155,7 @@ int EtherInit(ha)
memcpy(ha, CLLADDR(sdlp), 6);
break;
}
ifap = ifaddr.ifa_list.tqe_next;
ifap = TAILQ_NEXT(&ifaddr, ifa_list);
}
free(sdlp);
kvm_close(kvm);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_de.c,v 1.45 2007/03/04 06:00:56 christos Exp $ */
/* $NetBSD: if_de.c,v 1.46 2007/12/05 01:02:53 dyoung Exp $ */
/*
* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.45 2007/03/04 06:00:56 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.46 2007/12/05 01:02:53 dyoung Exp $");
#include "opt_inet.h"
#include "opt_iso.h"
@ -267,7 +267,7 @@ deinit(ds)
int s,incaddr;
/* not yet, if address still unknown */
if (ifp->if_addrlist.tqh_first == (struct ifaddr *)0)
if (TAILQ_EMPTY(&ifp->if_addrlist))
return;
if (ds->ds_flags & DSF_RUNNING)