Date: Thu, 27 Apr 2000 18:57:54 -0700 From: Jake Burkholder <jburkhol@home.com> To: Archie Cobbs <archie@FreeBSD.ORG> Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, jake@io.yi.org Subject: Re: cvs commit: src/sys/sys queue.h Message-ID: <20000428015754.A7AD0BCA7@io.yi.org> In-Reply-To: Message from Archie Cobbs <archie@FreeBSD.ORG> of "Thu, 27 Apr 2000 15:50:13 PDT." <200004272250.PAA26982@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> archie      2000/04/27 15:50:13 PDT
> 
>   Modified files:
>     sys/sys              queue.h 
>   Log:
>   Add a new macro CIRCLEQ_FOREACH_REVERSE for traversing through a
>   circle queue in the reverse direction (from tail to head).
>   
>   Revision  Changes    Path
>   1.34      +6 -1      src/sys/sys/queue.h
Any reason not to do the same for TAILQ?
I think the following works:
for (var = TAILQ_LAST(head, headname);
     var;
     var = TAILQ_PREV(elm, headname, field))
Also, how about something like FOOQ_FOREACH_COND(var, head, field, cond)?
i.e. for (var = FOOQ_FIRST(head);
	  var && cond;
	  var = FOOQ_NEXT(var, field))
When I was cleaning up the files in sys/kern to use the macros more
consistently I noticed a lot of places that traverse lists but can't
use the FOREACH because there's another condition in the loop.
Jake
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000428015754.A7AD0BCA7>
