diff options
author | rwatson <rwatson@FreeBSD.org> | 2008-04-06 21:20:56 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2008-04-06 21:20:56 +0000 |
commit | 00684a83a11ad3752fb1d161026fac369d5be9f8 (patch) | |
tree | f4cdaaaac701018784ba1339341da8b2a44323dd /sys/netinet6 | |
parent | 98cf7d12e7ca4dd24df1be67b793cc80451a73f6 (diff) | |
download | FreeBSD-src-00684a83a11ad3752fb1d161026fac369d5be9f8.zip FreeBSD-src-00684a83a11ad3752fb1d161026fac369d5be9f8.tar.gz |
In in_pcbnotifyall() and in6_pcbnotify(), use LIST_FOREACH_SAFE() and
eliminate unnecessary local variable caching of the list head pointer,
making the code a bit easier to read.
MFC after: 3 weeks
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 2419b89..a93b45a 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -573,8 +573,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst, int cmd, void *cmdarg, struct inpcb *(*notify)(struct inpcb *, int)) { - struct inpcbhead *head; - struct inpcb *inp, *ninp; + struct inpcb *inp, *inp_temp; struct sockaddr_in6 sa6_src, *sa6_dst; u_short fport = fport_arg, lport = lport_arg; u_int32_t flowinfo; @@ -610,12 +609,9 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst, notify = in6_rtchange; } errno = inet6ctlerrmap[cmd]; - head = pcbinfo->ipi_listhead; INP_INFO_WLOCK(pcbinfo); - for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) { + LIST_FOREACH_SAFE(inp, pcbinfo->ipi_listhead, inp_list, inp_temp) { INP_LOCK(inp); - ninp = LIST_NEXT(inp, inp_list); - if ((inp->inp_vflag & INP_IPV6) == 0) { INP_UNLOCK(inp); continue; |