Module Name: src
Committed By: ozaki-r
Date: Thu May 21 09:29:51 UTC 2015
Modified Files:
src/sys/netinet: if_arp.c
Log Message:
Use LIST_FOREACH{,_SAFE}
The first loop doesn't remove any items in it, so we can use
LIST_FOREACH instead of LIST_FOREACH_SAFE.
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/netinet/if_arp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.167 src/sys/netinet/if_arp.c:1.168
--- src/sys/netinet/if_arp.c:1.167 Thu May 21 09:27:10 2015
+++ src/sys/netinet/if_arp.c Thu May 21 09:29:51 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.167 2015/05/21 09:27:10 ozaki-r Exp $ */
+/* $NetBSD: if_arp.c,v 1.168 2015/05/21 09:29:51 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.167 2015/05/21 09:27:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.168 2015/05/21 09:29:51 ozaki-r Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -378,7 +378,7 @@ arp_drainstub(void)
void
arp_drain(void)
{
- struct llinfo_arp *la, *nla;
+ struct llinfo_arp *la;
int count = 0;
struct mbuf *mold;
@@ -389,9 +389,7 @@ arp_drain(void)
return;
}
- for (la = LIST_FIRST(&llinfo_arp); la != NULL; la = nla) {
- nla = LIST_NEXT(la, la_list);
-
+ LIST_FOREACH(la, &llinfo_arp, la_list) {
mold = la->la_hold;
la->la_hold = NULL;
@@ -426,10 +424,9 @@ arptimer(void *arg)
}
callout_reset(&arptimer_ch, arpt_prune * hz, arptimer, NULL);
- for (la = LIST_FIRST(&llinfo_arp); la != NULL; la = nla) {
+ LIST_FOREACH_SAFE(la, &llinfo_arp, la_list, nla) {
struct rtentry *rt = la->la_rt;
- nla = LIST_NEXT(la, la_list);
if (rt->rt_expire == 0)
continue;
if ((rt->rt_expire - time_second) < arpt_refresh &&