Author: glebius
Date: Thu Apr  9 09:00:32 2015
New Revision: 281296
URL: https://svnweb.freebsd.org/changeset/base/281296

Log:
  Use TAILQ_FOREACH_SAFE() instead of implementing it ourselves.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c Thu Apr  9 08:56:23 2015        (r281295)
+++ head/sys/netinet/ip_input.c Thu Apr  9 09:00:32 2015        (r281296)
@@ -1294,7 +1294,7 @@ void
 ip_slowtimo(void)
 {
        VNET_ITERATOR_DECL(vnet_iter);
-       struct ipq *fp;
+       struct ipq *fp, *tmp;
        int i;
 
        VNET_LIST_RLOCK_NOSLEEP();
@@ -1302,14 +1302,9 @@ ip_slowtimo(void)
                CURVNET_SET(vnet_iter);
                for (i = 0; i < IPREASS_NHASH; i++) {
                        IPQ_LOCK(i);
-                       for(fp = TAILQ_FIRST(&V_ipq[i]); fp;) {
-                               struct ipq *fpp;
-
-                               fpp = fp;
-                               fp = TAILQ_NEXT(fp, ipq_list);
-                               if(--fpp->ipq_ttl == 0)
-                                       ipq_timeout(&V_ipq[i], fpp);
-                       }
+                       TAILQ_FOREACH_SAFE(fp, &V_ipq[i], ipq_list, tmp)
+                               if (--fp->ipq_ttl == 0)
+                                       ipq_timeout(&V_ipq[i], fp);
                        IPQ_UNLOCK(i);
                }
                /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to