From owner-freebsd-current Tue Jul 2 23:52:11 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4547337B405 for ; Tue, 2 Jul 2002 23:52:09 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7CC2543E0A for ; Tue, 2 Jul 2002 23:52:07 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id QAA07218; Wed, 3 Jul 2002 16:51:55 +1000 Date: Wed, 3 Jul 2002 16:57:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Ian Dowse Cc: Jonathan Lemon , Subject: Re: additional queue macro In-Reply-To: <200207021613.aa59595@salmon.maths.tcd.ie> Message-ID: <20020703164536.O15214-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 2 Jul 2002, Ian Dowse wrote: > In message <20020702095402.D1020@prism.flugsvamp.com>, Jonathan Lemon writes: > >Essentially, this provides a traversal of the tailq that is safe > >from element removal, while being simple to drop in to those sections > >of the code that need updating, as evidenced in the patch below. > > Note that this of course is not "safe from element removal" in > general; it is just safe when you remove any element other than the > next element, whereas TAILQ_FOREACH is safe when you remove any > element other than the current one. For example it would not be > safe to call a callback that could potentially remove arbitrary > elements. > > It may be clearer in this case just to expand the macro in the code > so that it is more obvious what assumptions can be made. This would be clearer in all case :-). I think even the committer of the FOREACH macros thinks that they shouldn't be used if the list traversal has any surprises. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message