summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-04-14 18:22:02 +0000
committerphk <phk@FreeBSD.org>1997-04-14 18:22:02 +0000
commitfe8656a98fc996e1091e2cde2fa1b51aa822093f (patch)
tree7a8b47edf9363988b0d8878832d9c7d237bd74aa /sys
parent3320ec653067be1e1067f93d8be55a3f9aed9fe8 (diff)
downloadFreeBSD-src-fe8656a98fc996e1091e2cde2fa1b51aa822093f.zip
FreeBSD-src-fe8656a98fc996e1091e2cde2fa1b51aa822093f.tar.gz
Add LIST_FIRST, LIST_FOREACH and LIST_NEXT
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/queue.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index e8758cd..0e042d3 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 = \
OpenPOWER on IntegriCloud