From fe8656a98fc996e1091e2cde2fa1b51aa822093f Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 14 Apr 1997 18:22:02 +0000 Subject: [PATCH] Add LIST_FIRST, LIST_FOREACH and LIST_NEXT --- sys/sys/queue.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/sys/queue.h b/sys/sys/queue.h index e8758cd1273d..0e042d3cce98 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 - * $Id$ + * $Id: queue.h,v 1.13 1997/02/22 09:45:44 peter Exp $ */ #ifndef _SYS_QUEUE_H_ @@ -217,6 +217,11 @@ struct { \ /* * List functions. */ +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) + #define LIST_INIT(head) { \ (head)->lh_first = NULL; \ } @@ -243,6 +248,8 @@ struct { \ (elm)->field.le_prev = &(head)->lh_first; \ } +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + #define LIST_REMOVE(elm, field) { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \