summaryrefslogtreecommitdiff
path: root/openbsd-compat/sys-queue.h
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2005-01-04 13:07:27 +0000
committerColin Watson <cjwatson@debian.org>2005-01-04 13:07:27 +0000
commitfd0f611b70a83d80fe8793af785542ee5541b7cd (patch)
treebededd22bb7eeec52e20083237ab7e4113445a16 /openbsd-compat/sys-queue.h
parentc44fe9a5b9d3db96a7249b04d915f17e4a3a3b04 (diff)
parentebd2ce335af5861020c79fddb1ae35c03bf036cf (diff)
Merge 3.9p1 to the trunk.
Diffstat (limited to 'openbsd-compat/sys-queue.h')
-rw-r--r--openbsd-compat/sys-queue.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/openbsd-compat/sys-queue.h b/openbsd-compat/sys-queue.h
index 8ff19e452..c49a94650 100644
--- a/openbsd-compat/sys-queue.h
+++ b/openbsd-compat/sys-queue.h
@@ -1,6 +1,6 @@
1/* OPENBSD ORIGINAL: sys/sys/queue.h */ 1/* OPENBSD ORIGINAL: sys/sys/queue.h */
2 2
3/* $OpenBSD: queue.h,v 1.23 2003/06/02 23:28:21 millert Exp $ */ 3/* $OpenBSD: queue.h,v 1.25 2004/04/08 16:08:21 henning Exp $ */
4/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ 4/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
5 5
6/* 6/*
@@ -38,12 +38,13 @@
38#define _FAKE_QUEUE_H_ 38#define _FAKE_QUEUE_H_
39 39
40/* 40/*
41 * Ignore all <sys/queue.h> since older platforms have broken/incomplete 41 * Require for OS/X and other platforms that have old/broken/incomplete
42 * <sys/queue.h> that are too hard to work around. 42 * <sys/queue.h>.
43 */ 43 */
44#undef SLIST_HEAD 44#undef SLIST_HEAD
45#undef SLIST_HEAD_INITIALIZER 45#undef SLIST_HEAD_INITIALIZER
46#undef SLIST_ENTRY 46#undef SLIST_ENTRY
47#undef SLIST_FOREACH_PREVPTR
47#undef SLIST_FIRST 48#undef SLIST_FIRST
48#undef SLIST_END 49#undef SLIST_END
49#undef SLIST_EMPTY 50#undef SLIST_EMPTY
@@ -54,6 +55,7 @@
54#undef SLIST_INSERT_HEAD 55#undef SLIST_INSERT_HEAD
55#undef SLIST_REMOVE_HEAD 56#undef SLIST_REMOVE_HEAD
56#undef SLIST_REMOVE 57#undef SLIST_REMOVE
58#undef SLIST_REMOVE_NEXT
57#undef LIST_HEAD 59#undef LIST_HEAD
58#undef LIST_HEAD_INITIALIZER 60#undef LIST_HEAD_INITIALIZER
59#undef LIST_ENTRY 61#undef LIST_ENTRY
@@ -194,6 +196,11 @@ struct { \
194 (var) != SLIST_END(head); \ 196 (var) != SLIST_END(head); \
195 (var) = SLIST_NEXT(var, field)) 197 (var) = SLIST_NEXT(var, field))
196 198
199#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
200 for ((varp) = &SLIST_FIRST((head)); \
201 ((var) = *(varp)) != SLIST_END(head); \
202 (varp) = &SLIST_NEXT((var), field))
203
197/* 204/*
198 * Singly-linked List functions. 205 * Singly-linked List functions.
199 */ 206 */
@@ -211,6 +218,10 @@ struct { \
211 (head)->slh_first = (elm); \ 218 (head)->slh_first = (elm); \
212} while (0) 219} while (0)
213 220
221#define SLIST_REMOVE_NEXT(head, elm, field) do { \
222 (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
223} while (0)
224
214#define SLIST_REMOVE_HEAD(head, field) do { \ 225#define SLIST_REMOVE_HEAD(head, field) do { \
215 (head)->slh_first = (head)->slh_first->field.sle_next; \ 226 (head)->slh_first = (head)->slh_first->field.sle_next; \
216} while (0) 227} while (0)
@@ -400,7 +411,7 @@ struct { \
400 (var) != TAILQ_END(head); \ 411 (var) != TAILQ_END(head); \
401 (var) = TAILQ_NEXT(var, field)) 412 (var) = TAILQ_NEXT(var, field))
402 413
403#define TAILQ_FOREACH_REVERSE(var, head, field, headname) \ 414#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
404 for((var) = TAILQ_LAST(head, headname); \ 415 for((var) = TAILQ_LAST(head, headname); \
405 (var) != TAILQ_END(head); \ 416 (var) != TAILQ_END(head); \
406 (var) = TAILQ_PREV(var, headname, field)) 417 (var) = TAILQ_PREV(var, headname, field))