Date: Tue, 30 Apr 2013 21:10:40 -0700 From: Alfred Perlstein <bright@mu.org> To: Lawrence Stewart <lstewart@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Adding a FOREACH_CONTINUE() variant to queue(3) Message-ID: <518095C0.30605@mu.org> In-Reply-To: <518092BF.9070105@freebsd.org> References: <518092BF.9070105@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 4/30/13 8:57 PM, Lawrence Stewart wrote: > [reposting from freebsd-arch@ - was probably the wrong list] > > Hi all, > > I've had use for these a few times now when wanting to restart a loop at > a previously found element, and wonder if there are any thoughts about > sticking them (and equivalents for other list types) in <sys/queue.h>? > > Cheers, > Lawrence > > #define TAILQ_FOREACH_CONTINUE(var, head, field) \ > for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ > (var); \ > (var) = TAILQ_NEXT((var), field)) > > > #define SLIST_FOREACH_CONTINUE(var, head, field) \ > for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ > (var); \ > (var) = SLIST_NEXT((var), field)) > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > Can you show a few uses please? If it can significantly cut down on extra code it seems wise. -Alfred
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?518095C0.30605>