diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1997-04-14 18:22:02 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1997-04-14 18:22:02 +0000 |
commit | 0b5fe37814442e592578326b64d9747fa3542aa5 (patch) | |
tree | 22abfd1c3cb0ab252b162b99cfc1b8ff4d89f691 /sys/sys/queue.h | |
parent | 438d3e31888b31f8b184a1c40a4e14c826adb8f9 (diff) | |
download | src-0b5fe37814442e592578326b64d9747fa3542aa5.tar.gz src-0b5fe37814442e592578326b64d9747fa3542aa5.zip |
Add LIST_FIRST, LIST_FOREACH and LIST_NEXT
Notes
Notes:
svn path=/head/; revision=24935
Diffstat (limited to 'sys/sys/queue.h')
-rw-r--r-- | sys/sys/queue.h | 9 |
1 files changed, 8 insertions, 1 deletions
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 = \ |