From 3e88ebfc3bb1caf670976b0728a058d37f5b2d3a Mon Sep 17 00:00:00 2001 From: archie Date: Thu, 27 Apr 2000 22:50:12 +0000 Subject: Add a new macro CIRCLEQ_FOREACH_REVERSE for traversing through a circle queue in the reverse direction (from tail to head). --- sys/sys/queue.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys') diff --git a/sys/sys/queue.h b/sys/sys/queue.h index b34558a..d20354f 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -417,6 +417,11 @@ struct { \ (var) != (void *)(head); \ (var) = (var)->field.cqe_next) +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for((var) = (head)->cqh_last; \ + (var) != (void *)(head); \ + (var) = (var)->field.cqe_prev) + #define CIRCLEQ_INIT(head) do { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ -- cgit v1.1