Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys refactor: use TAILQ_FOREACH instead of TAILQ_FOREACH_SAF...
details: https://anonhg.NetBSD.org/src/rev/73ee28131ddf
branches: trunk
changeset: 366696:73ee28131ddf
user: knakahara <knakahara%NetBSD.org@localhost>
date: Thu Jun 09 07:01:27 2022 +0000
description:
refactor: use TAILQ_FOREACH instead of TAILQ_FOREACH_SAFE about inpt_queue.
They don't use "ninph" pointer and don't remove elements.
diffstat:
sys/netinet/in_pcb.c | 16 ++++++++--------
sys/netinet6/in6_pcb.c | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diffs (121 lines):
diff -r 12ec42713db8 -r 73ee28131ddf sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c Wed Jun 08 23:12:27 2022 +0000
+++ b/sys/netinet/in_pcb.c Thu Jun 09 07:01:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.186 2021/10/19 20:01:09 roy Exp $ */
+/* $NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.186 2021/10/19 20:01:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -719,12 +719,12 @@
in_pcbnotifyall(struct inpcbtable *table, struct in_addr faddr, int errno,
void (*notify)(struct inpcb *, int))
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
if (in_nullhost(faddr) || notify == 0)
return;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
@@ -768,9 +768,9 @@
void
in_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp)
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
bool need_unlock = false;
@@ -795,9 +795,9 @@
in_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp)
{
struct rtentry *rt;
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
diff -r 12ec42713db8 -r 73ee28131ddf sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c Wed Jun 08 23:12:27 2022 +0000
+++ b/sys/netinet6/in6_pcb.c Thu Jun 09 07:01:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.167 2020/09/08 14:12:57 christos Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.168 2022/06/09 07:01:27 knakahara Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.167 2020/09/08 14:12:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.168 2022/06/09 07:01:27 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -698,7 +698,7 @@
u_int fport_arg, const struct sockaddr *src, u_int lport_arg, int cmd,
void *cmdarg, void (*notify)(struct in6pcb *, int))
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
struct sockaddr_in6 sa6_src;
const struct sockaddr_in6 *sa6_dst;
u_int16_t fport = fport_arg, lport = lport_arg;
@@ -737,7 +737,7 @@
}
errno = inet6ctlerrmap[cmd];
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
struct rtentry *rt = NULL;
@@ -843,13 +843,13 @@
void
in6_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp)
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
struct ip6_moptions *im6o;
struct in6_multi_mship *imm, *nimm;
KASSERT(ifp != NULL);
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
bool need_unlock = false;
if (in6p->in6p_af != AF_INET6)
@@ -896,9 +896,9 @@
in6_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp)
{
struct rtentry *rt;
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
if (in6p->in6p_af != AF_INET6)
continue;
Home |
Main Index |
Thread Index |
Old Index