Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Use LIST_FOREACH{,_SAFE}
details: https://anonhg.NetBSD.org/src/rev/369b4d8ae292
branches: trunk
changeset: 338394:369b4d8ae292
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu May 21 09:29:51 2015 +0000
description:
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.
diffstat:
sys/netinet/if_arp.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diffs (50 lines):
diff -r 969afc472cd1 -r 369b4d8ae292 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Thu May 21 09:27:10 2015 +0000
+++ b/sys/netinet/if_arp.c Thu May 21 09:29:51 2015 +0000
@@ -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 @@
void
arp_drain(void)
{
- struct llinfo_arp *la, *nla;
+ struct llinfo_arp *la;
int count = 0;
struct mbuf *mold;
@@ -389,9 +389,7 @@
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 @@
}
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 &&
Home |
Main Index |
Thread Index |
Old Index