Date: Wed, 3 Jul 2002 16:57:51 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Ian Dowse <iedowse@maths.tcd.ie> Cc: Jonathan Lemon <jlemon@flugsvamp.com>, <current@FreeBSD.ORG> Subject: Re: additional queue macro Message-ID: <20020703164536.O15214-100000@gamplex.bde.org> In-Reply-To: <200207021613.aa59595@salmon.maths.tcd.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020703164536.O15214-100000>