about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-03-05 05:50:39 +0000
committerUlrich Drepper <drepper@redhat.com>2008-03-05 05:50:39 +0000
commita4bb445a63b483818ed5a7c20d45581d63dad326 (patch)
tree9345b8724caa44e4065c8a8859bdd04ec461341d
parent15600683c773fd39d50f3af610d5adafcd75dc00 (diff)
downloadglibc-a4bb445a63b483818ed5a7c20d45581d63dad326.tar.gz
glibc-a4bb445a63b483818ed5a7c20d45581d63dad326.tar.xz
glibc-a4bb445a63b483818ed5a7c20d45581d63dad326.zip
[BZ #5779]
	* misc/sys/queue.h: Add STAILQ_CONCAT and TAILQ_CONCAT definitions.
	Patch by Roy Marples <roy@marples.name>.
-rw-r--r--ChangeLog4
-rw-r--r--misc/sys/queue.h17
2 files changed, 21 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f3ebffb817..2e5a9b75ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-03-04  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #5779]
+	* misc/sys/queue.h: Add STAILQ_CONCAT and TAILQ_CONCAT definitions.
+	Patch by Roy Marples <roy@marples.name>.
+
 	[BZ #5736]
 	* malloc/malloc.c: Fix typo in comment.
 
diff --git a/misc/sys/queue.h b/misc/sys/queue.h
index b0e6b38c19..daf4553d33 100644
--- a/misc/sys/queue.h
+++ b/misc/sys/queue.h
@@ -271,6 +271,14 @@ struct {								\
 		(var);							\
 		(var) = ((var)->field.stqe_next))
 
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
 /*
  * Singly-linked Tail queue access methods.
  */
@@ -434,6 +442,15 @@ struct {								\
 		(var);							\
 		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
 
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
 /*
  * Tail queue access methods.
  */