Adding a FOREACH_CONTINUE() variant to queue(3)
Lawrence Stewart
lstewart at freebsd.org
Sat Apr 27 06:35:17 UTC 2013
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))
More information about the freebsd-arch
mailing list