From owner-cvs-src@FreeBSD.ORG Fri Jun 30 08:39:50 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 554AF16A505; Fri, 30 Jun 2006 08:39:50 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4520643D45; Fri, 30 Jun 2006 08:39:47 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id k5U8dgv5077501; Fri, 30 Jun 2006 12:39:42 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id k5U8dgO3077500; Fri, 30 Jun 2006 12:39:42 +0400 (MSD) (envelope-from yar) Date: Fri, 30 Jun 2006 12:39:42 +0400 From: Yar Tikhiy To: "Christian S.J. Peron" Message-ID: <20060630083942.GA71578@comp.chem.msu.su> References: <200606291537.k5TFbeUg075956@repoman.freebsd.org> <44A45D3E.2040004@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44A45D3E.2040004@FreeBSD.org> User-Agent: Mutt/1.5.9i Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/nfsclient bootp_subr.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jun 2006 08:39:50 -0000 On Thu, Jun 29, 2006 at 06:07:42PM -0500, Christian S.J. Peron wrote: > Yar Tikhiy wrote: > >yar 2006-06-29 15:37:39 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/nfsclient bootp_subr.c > > Log: > > Use the elegant TAILQ_FOREACH() in place of a hand-rolled for() loop. > > > > Revision Changes Path > > 1.65 +1 -3 src/sys/nfsclient/bootp_subr.c > > > > > > > Just as a point of curiosity, in some places, people are using for loops > to avoid invalid pointer dereferences in the event that one of the queue > items is removed by the code in the loop while iterating. Are you using > TAILQ_FOREACH_SAFE() in such places if required? I was aware of TAILQ_FOREACH_SAFE(), but I didn't meet such places. All the code I'd changed fell into the simpler, scan'n'find, case. I was removing bogus ifa->ifa_addr checks from the networking code, and for some funny reason, almost each check found was sitting next to an old for() loop begging to be turned into TAILQ_FOREACH(). Did I miss a great idea hidden behind that? :-) -- Yar