]> git.sur5r.net Git - openldap/commitdiff
ITS#8576 Revert "LDAP_TAILQ fix"
authorHoward Chu <hyc@openldap.org>
Wed, 1 Feb 2017 11:10:31 +0000 (11:10 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 1 Feb 2017 11:58:54 +0000 (11:58 +0000)
This reverts commit 8ee824832844c16d4199f3aacd8b1d613933a7d5.

include/ldap_queue.h
servers/slapd/back-ldap/bind.c
servers/slapd/back-meta/conn.c

index 1b711b10cbc888d9eefdaa5ed71940062db9c75a..8e13582ed122dce4fffb90a081375a17d7c000c2 100644 (file)
@@ -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;                                       \
index f58090df2575ee38df325cddd2c4b04bddcaf9dd..5d6034ad67611453cc542243b838045fb3043b2b 100644 (file)
@@ -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 );
index 3d13a529f1e8dfa19017a3bb06654bb34c9d65b0..59b60c759e34b0dd360791915e894c1231bcaa94 100644 (file)
@@ -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 );