changeset 2440:ccf0842319fe draft

Add more TAILQ #ifdef tests for older queue.h's
author Roy Marples <roy@marples.name>
date Fri, 25 Apr 2014 08:46:08 +0000
parents 53293fabc47a
children 1cc6480fcc9a
files compat/queue.h
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/compat/queue.h	Fri Apr 25 08:31:26 2014 +0000
+++ b/compat/queue.h	Fri Apr 25 08:46:08 2014 +0000
@@ -59,10 +59,12 @@
 	qual type *qual *tqe_prev;	/* address of previous next element */\
 }
 #define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+#endif /* !TAILQ_HEAD */
 
 /*
  * Tail queue access methods.
  */
+#ifndef TAILQ_FIRST
 #define	TAILQ_FIRST(head)		((head)->tqh_first)
 #define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
 #define	TAILQ_LAST(head, headname) \
@@ -70,8 +72,9 @@
 #define	TAILQ_PREV(elm, headname, field) \
 	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 #define	TAILQ_EMPTY(head)		(TAILQ_FIRST(head) == TAILQ_END(head))
+#endif /* !TAILQ_FIRST */
 
-
+#ifndef TAILQ_FOREACH
 #define	TAILQ_FOREACH(var, head, field)					\
 	for ((var) = ((head)->tqh_first);				\
 	    (var) != TAILQ_END(head);					\
@@ -81,7 +84,9 @@
 	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
 	    (var) != TAILQ_END(head);					\
 	    (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+#endif /* !TAILQ_FOREACH */
 
+#ifndef TAILQ_INIT
 #define	TAILQ_INIT(head) do {						\
 	(head)->tqh_first = TAILQ_END(head);				\
 	(head)->tqh_last = &(head)->tqh_first;				\
@@ -130,7 +135,9 @@
 		(head)->tqh_last = (elm)->field.tqe_prev;		\
 	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
 } while (/*CONSTCOND*/0)
+#endif /* !TAILQ_INIT */
 
+#ifndef TAILQ_REPLACE
 #define TAILQ_REPLACE(head, elm, elm2, field) do {                      \
         if (((elm2)->field.tqe_next = (elm)->field.tqe_next) !=		\
 	    TAILQ_END(head))						\
@@ -141,7 +148,7 @@
         (elm2)->field.tqe_prev = (elm)->field.tqe_prev;                 \
         *(elm2)->field.tqe_prev = (elm2);                               \
 } while (/*CONSTCOND*/0)
-#endif /* !TAILQ_HEAD */
+#endif /* !TAILQ_REPLACE */
 
 #ifndef TAILQ_FOREACH_SAFE
 #define	TAILQ_FOREACH_SAFE(var, head, field, next)			\