Update queue.h with latest NetBSD's version.
This commit is contained in:
parent
bdd48de67d
commit
ec15af17a0
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: queue.h,v 1.49 2008/06/15 16:42:18 christos Exp $ */
|
/* $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -230,6 +230,11 @@ struct { \
|
|||||||
#define SLIST_FOREACH(var, head, field) \
|
#define SLIST_FOREACH(var, head, field) \
|
||||||
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
||||||
|
|
||||||
|
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||||
|
for ((var) = SLIST_FIRST((head)); \
|
||||||
|
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
|
||||||
|
(var) = (tvar))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Singly-linked List access methods.
|
* Singly-linked List access methods.
|
||||||
*/
|
*/
|
||||||
@ -304,6 +309,11 @@ struct { \
|
|||||||
(var); \
|
(var); \
|
||||||
(var) = ((var)->field.stqe_next))
|
(var) = ((var)->field.stqe_next))
|
||||||
|
|
||||||
|
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||||
|
for ((var) = STAILQ_FIRST((head)); \
|
||||||
|
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||||
|
(var) = (tvar))
|
||||||
|
|
||||||
#define STAILQ_CONCAT(head1, head2) do { \
|
#define STAILQ_CONCAT(head1, head2) do { \
|
||||||
if (!STAILQ_EMPTY((head2))) { \
|
if (!STAILQ_EMPTY((head2))) { \
|
||||||
*(head1)->stqh_last = (head2)->stqh_first; \
|
*(head1)->stqh_last = (head2)->stqh_first; \
|
||||||
@ -312,6 +322,12 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (/*CONSTCOND*/0)
|
} while (/*CONSTCOND*/0)
|
||||||
|
|
||||||
|
#define STAILQ_LAST(head, type, field) \
|
||||||
|
(STAILQ_EMPTY((head)) ? \
|
||||||
|
NULL : \
|
||||||
|
((struct type *)(void *) \
|
||||||
|
((char *)((head)->stqh_last) - offsetof(struct type, field))))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Singly-linked Tail queue access methods.
|
* Singly-linked Tail queue access methods.
|
||||||
*/
|
*/
|
||||||
@ -386,6 +402,25 @@ struct { \
|
|||||||
(var); \
|
(var); \
|
||||||
(var) = ((var)->field.sqe_next))
|
(var) = ((var)->field.sqe_next))
|
||||||
|
|
||||||
|
#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
|
||||||
|
for ((var) = ((head)->sqh_first); \
|
||||||
|
(var) && ((next = ((var)->field.sqe_next)), 1); \
|
||||||
|
(var) = (next))
|
||||||
|
|
||||||
|
#define SIMPLEQ_CONCAT(head1, head2) do { \
|
||||||
|
if (!SIMPLEQ_EMPTY((head2))) { \
|
||||||
|
*(head1)->sqh_last = (head2)->sqh_first; \
|
||||||
|
(head1)->sqh_last = (head2)->sqh_last; \
|
||||||
|
SIMPLEQ_INIT((head2)); \
|
||||||
|
} \
|
||||||
|
} while (/*CONSTCOND*/0)
|
||||||
|
|
||||||
|
#define SIMPLEQ_LAST(head, type, field) \
|
||||||
|
(SIMPLEQ_EMPTY((head)) ? \
|
||||||
|
NULL : \
|
||||||
|
((struct type *)(void *) \
|
||||||
|
((char *)((head)->sqh_last) - offsetof(struct type, field))))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple queue access methods.
|
* Simple queue access methods.
|
||||||
*/
|
*/
|
||||||
@ -518,6 +553,11 @@ struct { \
|
|||||||
(var); \
|
(var); \
|
||||||
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
||||||
|
|
||||||
|
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
|
||||||
|
for ((var) = TAILQ_LAST((head), headname); \
|
||||||
|
(var) && ((prev) = TAILQ_PREV((var), headname, field), 1);\
|
||||||
|
(var) = (prev))
|
||||||
|
|
||||||
#define TAILQ_CONCAT(head1, head2, field) do { \
|
#define TAILQ_CONCAT(head1, head2, field) do { \
|
||||||
if (!TAILQ_EMPTY(head2)) { \
|
if (!TAILQ_EMPTY(head2)) { \
|
||||||
*(head1)->tqh_last = (head2)->tqh_first; \
|
*(head1)->tqh_last = (head2)->tqh_first; \
|
||||||
|
Loading…
Reference in New Issue
Block a user