From 3478cb24e619fa75810f0cb4699deceaa57e357f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 2 Jan 2002 23:53:57 +0000 Subject: [PATCH] Moved queue-compat.h to ldap_queue.h, added LDAP_ prefix to all macros --- include/{queue-compat.h => ldap_queue.h} | 165 +++++++++++------------ 1 file changed, 80 insertions(+), 85 deletions(-) rename include/{queue-compat.h => ldap_queue.h} (76%) diff --git a/include/queue-compat.h b/include/ldap_queue.h similarity index 76% rename from include/queue-compat.h rename to include/ldap_queue.h index a3c07aaafe..bdb239dc82 100644 --- a/include/queue-compat.h +++ b/include/ldap_queue.h @@ -46,8 +46,8 @@ * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.5 2001/09/30 21:12:54 luigi Exp $ */ -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ +#ifndef _LDAP_QUEUE_H_ +#define _LDAP_QUEUE_H_ /* * This file defines five types of data structures: singly-linked lists, @@ -99,7 +99,7 @@ * For details on the use of these macros, see the queue(3) manual page. * * - * SLIST LIST STAILQ TAILQ CIRCLEQ + * LDAP_SLIST LIST LDAP_STAILQ TAILQ LDAP_CIRCLEQ * _HEAD + + + + + * _ENTRY + + + + + * _INIT + + + + + @@ -122,23 +122,18 @@ * see queue(3) for instructions on how to use */ -/* The latest set of Windows headers defines SLIST_ENTRY in WINNT.H */ -#ifdef SLIST_ENTRY -#undef SLIST_ENTRY -#endif - /* * Singly-linked List definitions. */ -#define SLIST_HEAD(name, type) \ +#define LDAP_SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } -#define SLIST_HEAD_INITIALIZER(head) \ +#define LDAP_SLIST_HEAD_INITIALIZER(head) \ { NULL } -#define SLIST_ENTRY(type) \ +#define LDAP_SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } @@ -146,36 +141,36 @@ struct { \ /* * Singly-linked List functions. */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define LDAP_SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) +#define LDAP_SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_FOREACH(var, head, field) \ +#define LDAP_SLIST_FOREACH(var, head, field) \ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) -#define SLIST_INIT(head) { \ +#define LDAP_SLIST_INIT(head) { \ (head)->slh_first = NULL; \ } -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ +#define LDAP_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ (elm)->field.sle_next = (slistelm)->field.sle_next; \ (slistelm)->field.sle_next = (elm); \ } while (0) -#define SLIST_INSERT_HEAD(head, elm, field) do { \ +#define LDAP_SLIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.sle_next = (head)->slh_first; \ (head)->slh_first = (elm); \ } while (0) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) +#define LDAP_SLIST_NEXT(elm, field) ((elm)->field.sle_next) -#define SLIST_REMOVE_HEAD(head, field) do { \ +#define LDAP_SLIST_REMOVE_HEAD(head, field) do { \ (head)->slh_first = (head)->slh_first->field.sle_next; \ } while (0) -#define SLIST_REMOVE(head, elm, type, field) do { \ +#define LDAP_SLIST_REMOVE(head, elm, type, field) do { \ if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ + LDAP_SLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = (head)->slh_first; \ @@ -189,16 +184,16 @@ struct { \ /* * Singly-linked Tail queue definitions. */ -#define STAILQ_HEAD(name, type) \ +#define LDAP_STAILQ_HEAD(name, type) \ struct name { \ struct type *stqh_first;/* first element */ \ struct type **stqh_last;/* addr of last next element */ \ } -#define STAILQ_HEAD_INITIALIZER(head) \ +#define LDAP_STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } -#define STAILQ_ENTRY(type) \ +#define LDAP_STAILQ_ENTRY(type) \ struct { \ struct type *stqe_next; /* next element */ \ } @@ -206,58 +201,58 @@ struct { \ /* * Singly-linked Tail queue functions. */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define LDAP_STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_INIT(head) do { \ +#define LDAP_STAILQ_INIT(head) do { \ (head)->stqh_first = NULL; \ (head)->stqh_last = &(head)->stqh_first; \ } while (0) -#define STAILQ_FIRST(head) ((head)->stqh_first) +#define LDAP_STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_LAST(head, type, field) \ - (STAILQ_EMPTY(head) ? \ +#define LDAP_STAILQ_LAST(head, type, field) \ + (LDAP_STAILQ_EMPTY(head) ? \ NULL : \ ((struct type *) \ ((char *)((head)->stqh_last) - offsetof(struct type, field)))) -#define STAILQ_FOREACH(var, head, field) \ +#define LDAP_STAILQ_FOREACH(var, head, field) \ for((var) = (head)->stqh_first; (var); (var) = (var)->field.stqe_next) -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ +#define LDAP_STAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ (head)->stqh_last = &(elm)->field.stqe_next; \ (head)->stqh_first = (elm); \ } while (0) -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ +#define LDAP_STAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.stqe_next = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &(elm)->field.stqe_next; \ } while (0) -#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ +#define LDAP_STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if (((elm)->field.stqe_next = (tqelm)->field.stqe_next) == NULL)\ (head)->stqh_last = &(elm)->field.stqe_next; \ (tqelm)->field.stqe_next = (elm); \ } while (0) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) +#define LDAP_STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) -#define STAILQ_REMOVE_HEAD(head, field) do { \ +#define LDAP_STAILQ_REMOVE_HEAD(head, field) do { \ if (((head)->stqh_first = \ (head)->stqh_first->field.stqe_next) == NULL) \ (head)->stqh_last = &(head)->stqh_first; \ } while (0) -#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ +#define LDAP_STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ if (((head)->stqh_first = (elm)->field.stqe_next) == NULL) \ (head)->stqh_last = &(head)->stqh_first; \ } while (0) -#define STAILQ_REMOVE(head, elm, type, field) do { \ +#define LDAP_STAILQ_REMOVE(head, elm, type, field) do { \ if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD(head, field); \ + LDAP_STAILQ_REMOVE_HEAD(head, field); \ } \ else { \ struct type *curelm = (head)->stqh_first; \ @@ -272,15 +267,15 @@ struct { \ /* * List definitions. */ -#define LIST_HEAD(name, type) \ +#define LDAP_LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } -#define LIST_HEAD_INITIALIZER(head) \ +#define LDAP_LIST_HEAD_INITIALIZER(head) \ { NULL } -#define LIST_ENTRY(type) \ +#define LDAP_LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ @@ -290,18 +285,18 @@ struct { \ * List functions. */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LDAP_LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) +#define LDAP_LIST_FIRST(head) ((head)->lh_first) -#define LIST_FOREACH(var, head, field) \ +#define LDAP_LIST_FOREACH(var, head, field) \ for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) -#define LIST_INIT(head) do { \ +#define LDAP_LIST_INIT(head) do { \ (head)->lh_first = NULL; \ } while (0) -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ +#define LDAP_LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ @@ -309,23 +304,23 @@ struct { \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (0) -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ +#define LDAP_LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (0) -#define LIST_INSERT_HEAD(head, elm, field) do { \ +#define LDAP_LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) +#define LDAP_LIST_NEXT(elm, field) ((elm)->field.le_next) -#define LIST_REMOVE(elm, field) do { \ +#define LDAP_LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ @@ -335,16 +330,16 @@ struct { \ /* * Tail queue definitions. */ -#define TAILQ_HEAD(name, type) \ +#define LDAP_TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ } -#define TAILQ_HEAD_INITIALIZER(head) \ +#define LDAP_TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } -#define TAILQ_ENTRY(type) \ +#define LDAP_TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ @@ -353,32 +348,32 @@ struct { \ /* * Tail queue functions. */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define LDAP_TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FOREACH(var, head, field) \ - for (var = TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field)) +#define LDAP_TAILQ_FOREACH(var, head, field) \ + for (var = LDAP_TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field)) -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = TAILQ_LAST((head), headname); \ +#define LDAP_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = LDAP_TAILQ_LAST((head), headname); \ (var); \ - (var) = TAILQ_PREV((var), headname, field)) + (var) = LDAP_TAILQ_PREV((var), headname, field)) -#define TAILQ_FIRST(head) ((head)->tqh_first) +#define LDAP_TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_LAST(head, headname) \ +#define LDAP_TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#define LDAP_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define TAILQ_PREV(elm, headname, field) \ +#define LDAP_TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#define TAILQ_INIT(head) do { \ +#define LDAP_TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } while (0) -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ +#define LDAP_TAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (head)->tqh_first->field.tqe_prev = \ &(elm)->field.tqe_next; \ @@ -388,14 +383,14 @@ struct { \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } while (0) -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ +#define LDAP_TAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } while (0) -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ +#define LDAP_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ @@ -405,14 +400,14 @@ struct { \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } while (0) -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ +#define LDAP_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ (elm)->field.tqe_next = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (0) -#define TAILQ_REMOVE(head, elm, field) do { \ +#define LDAP_TAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ @@ -424,13 +419,13 @@ struct { \ /* * Circular queue definitions. */ -#define CIRCLEQ_HEAD(name, type) \ +#define LDAP_CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } -#define CIRCLEQ_ENTRY(type) \ +#define LDAP_CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ @@ -439,26 +434,26 @@ struct { \ /* * Circular queue functions. */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define LDAP_CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define LDAP_CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_FOREACH(var, head, field) \ +#define LDAP_CIRCLEQ_FOREACH(var, head, field) \ for((var) = (head)->cqh_first; \ (var) != (void *)(head); \ (var) = (var)->field.cqe_next) -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ +#define LDAP_CIRCLEQ_FOREACH_REVERSE(var, head, field) \ for((var) = (head)->cqh_last; \ (var) != (void *)(head); \ (var) = (var)->field.cqe_prev) -#define CIRCLEQ_INIT(head) do { \ +#define LDAP_CIRCLEQ_INIT(head) do { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ } while (0) -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ +#define LDAP_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ @@ -468,7 +463,7 @@ struct { \ (listelm)->field.cqe_next = (elm); \ } while (0) -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ +#define LDAP_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ @@ -478,7 +473,7 @@ struct { \ (listelm)->field.cqe_prev = (elm); \ } while (0) -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ +#define LDAP_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ @@ -488,7 +483,7 @@ struct { \ (head)->cqh_first = (elm); \ } while (0) -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ +#define LDAP_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ @@ -498,13 +493,13 @@ struct { \ (head)->cqh_last = (elm); \ } while (0) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define LDAP_CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) +#define LDAP_CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) +#define LDAP_CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) -#define CIRCLEQ_REMOVE(head, elm, field) do { \ +#define LDAP_CIRCLEQ_REMOVE(head, elm, field) do { \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ @@ -517,4 +512,4 @@ struct { \ (elm)->field.cqe_next; \ } while (0) -#endif /* !_SYS_QUEUE_H_ */ +#endif /* !_LDAP_QUEUE_H_ */ -- 2.39.5