diff options
Diffstat (limited to 'openbsd-compat/sys-queue.h')
-rw-r--r-- | openbsd-compat/sys-queue.h | 100 |
1 files changed, 14 insertions, 86 deletions
diff --git a/openbsd-compat/sys-queue.h b/openbsd-compat/sys-queue.h index 8ff19e452..dd289dc16 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 | /* |
@@ -34,89 +34,8 @@ | |||
34 | * @(#)queue.h 8.5 (Berkeley) 8/20/94 | 34 | * @(#)queue.h 8.5 (Berkeley) 8/20/94 |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #ifndef _FAKE_QUEUE_H_ | 37 | #ifndef _SYS_QUEUE_H_ |
38 | #define _FAKE_QUEUE_H_ | 38 | #define _SYS_QUEUE_H_ |
39 | |||
40 | /* | ||
41 | * Ignore all <sys/queue.h> since older platforms have broken/incomplete | ||
42 | * <sys/queue.h> that are too hard to work around. | ||
43 | */ | ||
44 | #undef SLIST_HEAD | ||
45 | #undef SLIST_HEAD_INITIALIZER | ||
46 | #undef SLIST_ENTRY | ||
47 | #undef SLIST_FIRST | ||
48 | #undef SLIST_END | ||
49 | #undef SLIST_EMPTY | ||
50 | #undef SLIST_NEXT | ||
51 | #undef SLIST_FOREACH | ||
52 | #undef SLIST_INIT | ||
53 | #undef SLIST_INSERT_AFTER | ||
54 | #undef SLIST_INSERT_HEAD | ||
55 | #undef SLIST_REMOVE_HEAD | ||
56 | #undef SLIST_REMOVE | ||
57 | #undef LIST_HEAD | ||
58 | #undef LIST_HEAD_INITIALIZER | ||
59 | #undef LIST_ENTRY | ||
60 | #undef LIST_FIRST | ||
61 | #undef LIST_END | ||
62 | #undef LIST_EMPTY | ||
63 | #undef LIST_NEXT | ||
64 | #undef LIST_FOREACH | ||
65 | #undef LIST_INIT | ||
66 | #undef LIST_INSERT_AFTER | ||
67 | #undef LIST_INSERT_BEFORE | ||
68 | #undef LIST_INSERT_HEAD | ||
69 | #undef LIST_REMOVE | ||
70 | #undef LIST_REPLACE | ||
71 | #undef SIMPLEQ_HEAD | ||
72 | #undef SIMPLEQ_HEAD_INITIALIZER | ||
73 | #undef SIMPLEQ_ENTRY | ||
74 | #undef SIMPLEQ_FIRST | ||
75 | #undef SIMPLEQ_END | ||
76 | #undef SIMPLEQ_EMPTY | ||
77 | #undef SIMPLEQ_NEXT | ||
78 | #undef SIMPLEQ_FOREACH | ||
79 | #undef SIMPLEQ_INIT | ||
80 | #undef SIMPLEQ_INSERT_HEAD | ||
81 | #undef SIMPLEQ_INSERT_TAIL | ||
82 | #undef SIMPLEQ_INSERT_AFTER | ||
83 | #undef SIMPLEQ_REMOVE_HEAD | ||
84 | #undef TAILQ_HEAD | ||
85 | #undef TAILQ_HEAD_INITIALIZER | ||
86 | #undef TAILQ_ENTRY | ||
87 | #undef TAILQ_FIRST | ||
88 | #undef TAILQ_END | ||
89 | #undef TAILQ_NEXT | ||
90 | #undef TAILQ_LAST | ||
91 | #undef TAILQ_PREV | ||
92 | #undef TAILQ_EMPTY | ||
93 | #undef TAILQ_FOREACH | ||
94 | #undef TAILQ_FOREACH_REVERSE | ||
95 | #undef TAILQ_INIT | ||
96 | #undef TAILQ_INSERT_HEAD | ||
97 | #undef TAILQ_INSERT_TAIL | ||
98 | #undef TAILQ_INSERT_AFTER | ||
99 | #undef TAILQ_INSERT_BEFORE | ||
100 | #undef TAILQ_REMOVE | ||
101 | #undef TAILQ_REPLACE | ||
102 | #undef CIRCLEQ_HEAD | ||
103 | #undef CIRCLEQ_HEAD_INITIALIZER | ||
104 | #undef CIRCLEQ_ENTRY | ||
105 | #undef CIRCLEQ_FIRST | ||
106 | #undef CIRCLEQ_LAST | ||
107 | #undef CIRCLEQ_END | ||
108 | #undef CIRCLEQ_NEXT | ||
109 | #undef CIRCLEQ_PREV | ||
110 | #undef CIRCLEQ_EMPTY | ||
111 | #undef CIRCLEQ_FOREACH | ||
112 | #undef CIRCLEQ_FOREACH_REVERSE | ||
113 | #undef CIRCLEQ_INIT | ||
114 | #undef CIRCLEQ_INSERT_AFTER | ||
115 | #undef CIRCLEQ_INSERT_BEFORE | ||
116 | #undef CIRCLEQ_INSERT_HEAD | ||
117 | #undef CIRCLEQ_INSERT_TAIL | ||
118 | #undef CIRCLEQ_REMOVE | ||
119 | #undef CIRCLEQ_REPLACE | ||
120 | 39 | ||
121 | /* | 40 | /* |
122 | * This file defines five types of data structures: singly-linked lists, | 41 | * This file defines five types of data structures: singly-linked lists, |
@@ -194,6 +113,11 @@ struct { \ | |||
194 | (var) != SLIST_END(head); \ | 113 | (var) != SLIST_END(head); \ |
195 | (var) = SLIST_NEXT(var, field)) | 114 | (var) = SLIST_NEXT(var, field)) |
196 | 115 | ||
116 | #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ | ||
117 | for ((varp) = &SLIST_FIRST((head)); \ | ||
118 | ((var) = *(varp)) != SLIST_END(head); \ | ||
119 | (varp) = &SLIST_NEXT((var), field)) | ||
120 | |||
197 | /* | 121 | /* |
198 | * Singly-linked List functions. | 122 | * Singly-linked List functions. |
199 | */ | 123 | */ |
@@ -211,6 +135,10 @@ struct { \ | |||
211 | (head)->slh_first = (elm); \ | 135 | (head)->slh_first = (elm); \ |
212 | } while (0) | 136 | } while (0) |
213 | 137 | ||
138 | #define SLIST_REMOVE_NEXT(head, elm, field) do { \ | ||
139 | (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ | ||
140 | } while (0) | ||
141 | |||
214 | #define SLIST_REMOVE_HEAD(head, field) do { \ | 142 | #define SLIST_REMOVE_HEAD(head, field) do { \ |
215 | (head)->slh_first = (head)->slh_first->field.sle_next; \ | 143 | (head)->slh_first = (head)->slh_first->field.sle_next; \ |
216 | } while (0) | 144 | } while (0) |
@@ -400,7 +328,7 @@ struct { \ | |||
400 | (var) != TAILQ_END(head); \ | 328 | (var) != TAILQ_END(head); \ |
401 | (var) = TAILQ_NEXT(var, field)) | 329 | (var) = TAILQ_NEXT(var, field)) |
402 | 330 | ||
403 | #define TAILQ_FOREACH_REVERSE(var, head, field, headname) \ | 331 | #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ |
404 | for((var) = TAILQ_LAST(head, headname); \ | 332 | for((var) = TAILQ_LAST(head, headname); \ |
405 | (var) != TAILQ_END(head); \ | 333 | (var) != TAILQ_END(head); \ |
406 | (var) = TAILQ_PREV(var, headname, field)) | 334 | (var) = TAILQ_PREV(var, headname, field)) |
@@ -579,4 +507,4 @@ struct { \ | |||
579 | (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ | 507 | (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ |
580 | } while (0) | 508 | } while (0) |
581 | 509 | ||
582 | #endif /* !_FAKE_QUEUE_H_ */ | 510 | #endif /* !_SYS_QUEUE_H_ */ |