mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-21 13:47:48 +00:00
90 lines
2.9 KiB
Diff
90 lines
2.9 KiB
Diff
Original patch from: gentoo/src/patchsets/glibc/2.9/1010_all_glibc-queue-header-updates.patch
|
|
|
|
-= BEGIN original header =-
|
|
grab some updates from FreeBSD
|
|
|
|
http://bugs.gentoo.org/201979
|
|
|
|
-= END original header =-
|
|
|
|
diff -durN glibc-2_9.orig/misc/sys/queue.h glibc-2_9/misc/sys/queue.h
|
|
--- glibc-2_9.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
|
|
+++ glibc-2_9/misc/sys/queue.h 2009-02-02 22:00:48.000000000 +0100
|
|
@@ -136,6 +136,11 @@
|
|
(var); \
|
|
(var) = ((var)->field.le_next))
|
|
|
|
+#define LIST_FOREACH_SAFE(var, head, field, tvar) \
|
|
+ for ((var) = LIST_FIRST((head)); \
|
|
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
|
|
+ (var) = (tvar))
|
|
+
|
|
/*
|
|
* List access methods.
|
|
*/
|
|
@@ -197,6 +202,16 @@
|
|
#define SLIST_FOREACH(var, head, field) \
|
|
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))
|
|
+
|
|
+#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
|
+ for ((varp) = &SLIST_FIRST((head)); \
|
|
+ ((var) = *(varp)) != NULL; \
|
|
+ (varp) = &SLIST_NEXT((var), field))
|
|
+
|
|
/*
|
|
* Singly-linked List access methods.
|
|
*/
|
|
@@ -242,6 +257,12 @@
|
|
(head)->stqh_last = &(elm)->field.stqe_next; \
|
|
} while (/*CONSTCOND*/0)
|
|
|
|
+#define STAILQ_LAST(head, type, field) \
|
|
+ (STAILQ_EMPTY((head)) ? \
|
|
+ NULL : \
|
|
+ ((struct type *)(void *) \
|
|
+ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
|
|
+
|
|
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
|
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
|
|
(head)->stqh_last = &(elm)->field.stqe_next; \
|
|
@@ -286,6 +307,11 @@
|
|
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
|
#define STAILQ_NEXT(elm, field) ((elm)->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))
|
|
+
|
|
|
|
/*
|
|
* Simple queue definitions.
|
|
@@ -437,11 +463,22 @@
|
|
(var); \
|
|
(var) = ((var)->field.tqe_next))
|
|
|
|
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
|
+ for ((var) = TAILQ_FIRST((head)); \
|
|
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
|
|
+ (var) = (tvar))
|
|
+
|
|
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
|
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
|
|
(var); \
|
|
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
|
|
|
+#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
|
|
+ for ((var) = TAILQ_LAST((head), headname); \
|
|
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
|
|
+ (var) = (tvar))
|
|
+
|
|
+
|
|
#define TAILQ_CONCAT(head1, head2, field) do { \
|
|
if (!TAILQ_EMPTY(head2)) { \
|
|
*(head1)->tqh_last = (head2)->tqh_first; \
|