Add LIST_FIRST, LIST_FOREACH and LIST_NEXT

This commit is contained in:
Poul-Henning Kamp 1997-04-14 18:22:02 +00:00
parent 438d3e3188
commit 0b5fe37814
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24935

View File

@ -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 = \