From: Howard Chu Date: Wed, 1 Feb 2017 11:10:31 +0000 (+0000) Subject: ITS#8576 Revert "LDAP_TAILQ fix" X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=451a9623f3108f397a58105041c6cd3bbf555b51;p=openldap ITS#8576 Revert "LDAP_TAILQ fix" This reverts commit 8ee824832844c16d4199f3aacd8b1d613933a7d5. --- diff --git a/include/ldap_queue.h b/include/ldap_queue.h index 1b711b10cb..8e13582ed1 100644 --- a/include/ldap_queue.h +++ b/include/ldap_queue.h @@ -384,26 +384,20 @@ struct { \ #define LDAP_TAILQ_FOREACH(var, head, field) \ for (var = LDAP_TAILQ_FIRST(head); var; var = LDAP_TAILQ_NEXT(var, field)) -#define LDAP_TAILQ_FOREACH_REVERSE(var, head, type, field) \ - for ((var) = LDAP_TAILQ_LAST((head), type, field); \ +#define LDAP_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = LDAP_TAILQ_LAST((head), headname); \ (var); \ - (var) = LDAP_TAILQ_PREV((var), head, type, field)) + (var) = LDAP_TAILQ_PREV((var), headname, field)) #define LDAP_TAILQ_FIRST(head) ((head)->tqh_first) -#define LDAP_TAILQ_LAST(head, type, field) \ - (LDAP_TAILQ_EMPTY(head) ? \ - NULL : \ - ((struct type *) \ - ((char *)((head)->tqh_last) - offsetof(struct type, field)))) +#define LDAP_TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) #define LDAP_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define LDAP_TAILQ_PREV(elm, head, type, field) \ - ((struct type *)((elm)->field.tqe_prev) == LDAP_TAILQ_FIRST(head) ? \ - NULL : \ - ((struct type *) \ - ((char *)((elm)->field.tqe_prev) - offsetof(struct type, field)))) +#define LDAP_TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define LDAP_TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index f58090df25..5d6034ad67 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -926,7 +926,7 @@ retry_lock: if ( lc != NULL ) { if ( lc != LDAP_TAILQ_LAST( &li->li_conn_priv[ LDAP_BACK_CONN2PRIV( lc ) ].lic_priv, - ldapconn_t, lc_q ) ) + lc_conn_priv_q ) ) { LDAP_TAILQ_REMOVE( &li->li_conn_priv[ LDAP_BACK_CONN2PRIV( lc ) ].lic_priv, lc, lc_q ); diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 3d13a529f1..59b60c759e 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -1157,7 +1157,7 @@ retry_lock:; if ( mc != NULL ) { /* move to tail of queue */ if ( mc != LDAP_TAILQ_LAST( &mi->mi_conn_priv[ LDAP_BACK_CONN2PRIV( mc ) ].mic_priv, - metaconn_t, mc_q ) ) + mc_conn_priv_q ) ) { LDAP_TAILQ_REMOVE( &mi->mi_conn_priv[ LDAP_BACK_CONN2PRIV( mc ) ].mic_priv, mc, mc_q );