Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 use FOREACH_SAFE.
details: https://anonhg.NetBSD.org/src/rev/8d3761dbeea8
branches: trunk
changeset: 773461:8d3761dbeea8
user: christos <christos%NetBSD.org@localhost>
date: Thu Feb 02 19:35:18 2012 +0000
description:
use FOREACH_SAFE.
diffstat:
sys/netinet6/nd6.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diffs (91 lines):
diff -r e198c6a2732a -r 8d3761dbeea8 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c Thu Feb 02 19:18:51 2012 +0000
+++ b/sys/netinet6/nd6.c Thu Feb 02 19:35:18 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.139 2011/12/19 11:59:58 drochner Exp $ */
+/* $NetBSD: nd6.c,v 1.140 2012/02/02 19:35:18 christos Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.139 2011/12/19 11:59:58 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.140 2012/02/02 19:35:18 christos Exp $");
#include "opt_ipsec.h"
@@ -534,8 +534,7 @@
/* expire default router list */
- for (dr = TAILQ_FIRST(&nd_defrouter); dr != NULL; dr = next_dr) {
- next_dr = TAILQ_NEXT(dr, dr_entry);
+ TAILQ_FOREACH_SAFE(dr, &nd_defrouter, dr_entry, next_dr) {
if (dr->expire && dr->expire < time_second) {
defrtrlist_del(dr);
}
@@ -613,8 +612,7 @@
}
/* expire prefix list */
- for (pr = LIST_FIRST(&nd_prefix); pr != NULL; pr = next_pr) {
- next_pr = LIST_NEXT(pr, ndpr_entry);
+ LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, next_pr) {
/*
* check prefix lifetime.
* since pltime is just for autoconf, pltime processing for
@@ -735,16 +733,15 @@
* in the routing table, in order to keep additional side effects as
* small as possible.
*/
- for (dr = TAILQ_FIRST(&nd_defrouter); dr != NULL; dr = ndr) {
- ndr = TAILQ_NEXT(dr, dr_entry);
+ TAILQ_FOREACH_SAFE(dr, &nd_defrouter, dr_entry, ndr) {
if (dr->installed)
continue;
if (dr->ifp == ifp)
defrtrlist_del(dr);
}
- for (dr = TAILQ_FIRST(&nd_defrouter); dr != NULL; dr = ndr) {
- ndr = TAILQ_NEXT(dr, dr_entry);
+
+ TAILQ_FOREACH_SAFE(dr, &nd_defrouter, dr_entry, ndr) {
if (!dr->installed)
continue;
@@ -753,8 +750,7 @@
}
/* Nuke prefix list entries toward ifp */
- for (pr = LIST_FIRST(&nd_prefix); pr != NULL; pr = npr) {
- npr = LIST_NEXT(pr, ndpr_entry);
+ LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) {
if (pr->ndpr_ifp == ifp) {
/*
* Because if_detach() does *not* release prefixes
@@ -1593,11 +1589,9 @@
struct nd_prefix *pfx, *next;
s = splsoftnet();
- for (pfx = LIST_FIRST(&nd_prefix); pfx; pfx = next) {
+ LIST_FOREACH_SAFE(pfx, &nd_prefix, ndpr_entry, next) {
struct in6_ifaddr *ia, *ia_next;
- next = LIST_NEXT(pfx, ndpr_entry);
-
if (IN6_IS_ADDR_LINKLOCAL(&pfx->ndpr_prefix.sin6_addr))
continue; /* XXX */
@@ -1624,8 +1618,7 @@
s = splsoftnet();
defrouter_reset();
- for (drtr = TAILQ_FIRST(&nd_defrouter); drtr; drtr = next) {
- next = TAILQ_NEXT(drtr, dr_entry);
+ TAILQ_FOREACH_SAFE(drtr, &nd_defrouter, dr_entry, next) {
defrtrlist_del(drtr);
}
defrouter_select();
Home |
Main Index |
Thread Index |
Old Index