From owner-svn-src-head@FreeBSD.ORG Thu Apr 9 09:00:33 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA336C97; Thu, 9 Apr 2015 09:00:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9527A10E; Thu, 9 Apr 2015 09:00:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3990XBr079796; Thu, 9 Apr 2015 09:00:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3990XFf079795; Thu, 9 Apr 2015 09:00:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201504090900.t3990XFf079795@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 9 Apr 2015 09:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281296 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2015 09:00:33 -0000 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); } /*