diff options
Diffstat (limited to 'openbsd-compat/sys-queue.h')
-rw-r--r-- | openbsd-compat/sys-queue.h | 19 |
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)) |