ITS#9001 manual changes

This commit is contained in:
Ondřej Kuzník 2021-03-24 13:04:43 +00:00
parent 51c444b065
commit e36d1e31c5
67 changed files with 480 additions and 485 deletions

View File

@ -71,7 +71,7 @@ authzid_conn_find( Connection *c )
authzid_conn_t *ac = NULL, tmp = { 0 };
tmp.conn = c;
ac = (authzid_conn_t *)avl_find( authzid_tree, (caddr_t)&tmp, authzid_conn_cmp );
ac = (authzid_conn_t *)ldap_avl_find( authzid_tree, (caddr_t)&tmp, authzid_conn_cmp );
if ( ac == NULL || ( ac != NULL && ac->refcnt != 0 ) ) {
ac = NULL;
}
@ -121,7 +121,7 @@ authzid_conn_insert( Connection *c, char flag )
ac->conn = c;
ac->refcnt = 0;
ac->authzid_flag = flag;
rc = avl_insert( &authzid_tree, (caddr_t)ac,
rc = ldap_avl_insert( &authzid_tree, (caddr_t)ac,
authzid_conn_cmp, authzid_conn_dup );
ldap_pvt_thread_mutex_unlock( &authzid_mutex );
@ -139,7 +139,7 @@ authzid_conn_remove( Connection *c )
ldap_pvt_thread_mutex_unlock( &authzid_mutex );
return -1;
}
tmp = avl_delete( &authzid_tree, (caddr_t)ac, authzid_conn_cmp );
tmp = ldap_avl_delete( &authzid_tree, (caddr_t)ac, authzid_conn_cmp );
ldap_pvt_thread_mutex_unlock( &authzid_mutex );
assert( tmp == ac );

View File

@ -281,7 +281,7 @@ vc_exop(
AC_MEMCPY( (char *)&tmp.conn, (const char *)cookie.bv_val, cookie.bv_len );
ldap_pvt_thread_mutex_lock( &vc_mutex );
conn = (vc_conn_t *)avl_find( vc_tree, (caddr_t)&tmp, vc_conn_cmp );
conn = (vc_conn_t *)ldap_avl_find( vc_tree, (caddr_t)&tmp, vc_conn_cmp );
if ( conn == NULL || ( conn != NULL && conn->refcnt != 0 ) ) {
conn = NULL;
ldap_pvt_thread_mutex_unlock( &vc_mutex );
@ -376,7 +376,7 @@ done:;
conn->conn = conn;
conn->refcnt--;
ldap_pvt_thread_mutex_lock( &vc_mutex );
rc = avl_insert( &vc_tree, (caddr_t)conn,
rc = ldap_avl_insert( &vc_tree, (caddr_t)conn,
vc_conn_cmp, vc_conn_dup );
ldap_pvt_thread_mutex_unlock( &vc_mutex );
assert( rc == 0 );
@ -392,7 +392,7 @@ done:;
vc_conn_t *tmp;
ldap_pvt_thread_mutex_lock( &vc_mutex );
tmp = avl_delete( &vc_tree, (caddr_t)conn, vc_conn_cmp );
tmp = ldap_avl_delete( &vc_tree, (caddr_t)conn, vc_conn_cmp );
ldap_pvt_thread_mutex_unlock( &vc_mutex );
}
SLAP_FREE( conn );

View File

@ -1,4 +1,4 @@
/* avl.h - avl tree definitions */
/* ldap_avl.h - avl tree definitions */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
@ -73,15 +73,15 @@ struct tavlnode {
#define AVL_THREAD 1
/* avl routines */
#define avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data)
#define avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
#define ldap_avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data)
#define ldap_avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
#endif /* AVL_INTERNALS */
#define avl_child(x,dir) ((x)->avl_bits[dir]) == AVL_CHILD ? \
#define ldap_avl_child(x,dir) ((x)->avl_bits[dir]) == AVL_CHILD ? \
(x)->avl_link[dir] : NULL
#define avl_lchild(x) avl_child(x,0)
#define avl_rchild(x) avl_child(x,1)
#define ldap_avl_lchild(x) ldap_avl_child(x,0)
#define ldap_avl_rchild(x) ldap_avl_child(x,1)
typedef int (*AVL_APPLY) LDAP_P((void *, void*));
typedef int (*AVL_CMP) LDAP_P((const void*, const void*));
@ -89,69 +89,69 @@ typedef int (*AVL_DUP) LDAP_P((void*, void*));
typedef void (*AVL_FREE) LDAP_P((void*));
LDAP_AVL_F( int )
avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
ldap_avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
LDAP_AVL_F( int )
avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
ldap_avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
LDAP_AVL_F( void* )
avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
ldap_avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
LDAP_AVL_F( void* )
avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
ldap_avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
LDAP_AVL_F( Avlnode* )
avl_find2 LDAP_P((Avlnode *, const void*, AVL_CMP));
ldap_avl_find2 LDAP_P((Avlnode *, const void*, AVL_CMP));
LDAP_AVL_F( void* )
avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
ldap_avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
#ifdef AVL_NONREENTRANT
LDAP_AVL_F( void* )
avl_getfirst LDAP_P((Avlnode *));
ldap_avl_getfirst LDAP_P((Avlnode *));
LDAP_AVL_F( void* )
avl_getnext LDAP_P((void));
ldap_avl_getnext LDAP_P((void));
#endif
LDAP_AVL_F( int )
avl_dup_error LDAP_P((void*, void*));
ldap_avl_dup_error LDAP_P((void*, void*));
LDAP_AVL_F( int )
avl_dup_ok LDAP_P((void*, void*));
ldap_avl_dup_ok LDAP_P((void*, void*));
LDAP_AVL_F( int )
avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
ldap_avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
LDAP_AVL_F( int )
avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int));
ldap_avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int));
LDAP_AVL_F( int )
tavl_free LDAP_P(( TAvlnode *root, AVL_FREE dfree ));
ldap_tavl_free LDAP_P(( TAvlnode *root, AVL_FREE dfree ));
LDAP_AVL_F( int )
tavl_insert LDAP_P((TAvlnode **, void*, AVL_CMP, AVL_DUP));
ldap_tavl_insert LDAP_P((TAvlnode **, void*, AVL_CMP, AVL_DUP));
LDAP_AVL_F( void* )
tavl_delete LDAP_P((TAvlnode **, void*, AVL_CMP));
ldap_tavl_delete LDAP_P((TAvlnode **, void*, AVL_CMP));
LDAP_AVL_F( void* )
tavl_find LDAP_P((TAvlnode *, const void*, AVL_CMP));
ldap_tavl_find LDAP_P((TAvlnode *, const void*, AVL_CMP));
LDAP_AVL_F( TAvlnode* )
tavl_find2 LDAP_P((TAvlnode *, const void*, AVL_CMP));
ldap_tavl_find2 LDAP_P((TAvlnode *, const void*, AVL_CMP));
LDAP_AVL_F( TAvlnode* )
tavl_find3 LDAP_P((TAvlnode *, const void*, AVL_CMP, int *ret));
ldap_tavl_find3 LDAP_P((TAvlnode *, const void*, AVL_CMP, int *ret));
#define TAVL_DIR_LEFT 0
#define TAVL_DIR_RIGHT 1
LDAP_AVL_F( TAvlnode* )
tavl_end LDAP_P((TAvlnode *, int direction));
ldap_tavl_end LDAP_P((TAvlnode *, int direction));
LDAP_AVL_F( TAvlnode* )
tavl_next LDAP_P((TAvlnode *, int direction));
ldap_tavl_next LDAP_P((TAvlnode *, int direction));
/* apply traversal types */
#define AVL_PREORDER 1

View File

@ -15,7 +15,7 @@
LIBRARY = libldap.la
PROGRAMS = apitest dntest ftest ltest urltest
PROGRAMS = apitest dntest ftest ltest urltest testavl
SRCS = bind.c open.c result.c error.c compare.c search.c \
controls.c messages.c references.c extended.c cyrus.c \
@ -31,7 +31,7 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \
assertion.c deref.c ldifutil.c ldif.c fetch.c lbase64.c \
msctrl.c psearchctrl.c threads.c rdwr.c tpool.c rq.c \
thr_posix.c thr_thr.c thr_nt.c thr_pth.c thr_debug.c \
account_usability.c
account_usability.c avl.c tavl.c testavl.c
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
controls.lo messages.lo references.lo extended.lo cyrus.lo \
@ -47,7 +47,7 @@ OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
assertion.lo deref.lo ldifutil.lo ldif.lo fetch.lo lbase64.lo \
msctrl.lo psearchctrl.lo threads.lo rdwr.lo tpool.lo rq.lo \
thr_posix.lo thr_thr.lo thr_nt.lo thr_pth.lo thr_debug.lo \
account_usability.lo
account_usability.lo avl.lo tavl.lo
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
@ -70,9 +70,14 @@ ftest: $(XLIBS) ftest.o
$(LTLINK) -o $@ ftest.o $(LIBS)
ltest: $(XLIBS) test.o
$(LTLINK) -o $@ test.o $(LIBS)
testavl: $(XLIBS) testavl.o
$(LTLINK) -o $@ testavl.o $(LIBS)
testtavl: $(XLIBS) testtavl.o
$(LTLINK) -o $@ testtavl.o $(LIBS)
urltest: $(XLIBS) urltest.o
$(LTLINK) -o $@ urltest.o $(LIBS)
CFFILES=ldap.conf
install-local: $(CFFILES) FORCE

View File

@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2021 The OpenLDAP Foundation.
* Copyright 1998-2020 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,7 +47,7 @@
#endif
#define AVL_INTERNAL
#include "avl.h"
#include "ldap_avl.h"
/* Maximum tree depth this host's address space could support */
#define MAX_TREE_DEPTH (sizeof(void *) * CHAR_BIT)
@ -55,13 +55,13 @@
static const int avl_bfs[] = {LH, RH};
/*
* avl_insert -- insert a node containing data data into the avl tree
* ldap_avl_insert -- insert a node containing data data into the avl tree
* with root root. fcmp is a function to call to compare the data portion
* of two nodes. it should take two arguments and return <, >, or == 0,
* depending on whether its first argument is <, >, or == its second
* argument (like strcmp, e.g.). fdup is a function to call when a duplicate
* node is inserted. it should return 0, or -1 and its return value
* will be the return value from avl_insert in the case of a duplicate node.
* will be the return value from ldap_avl_insert in the case of a duplicate node.
* the function will be called with the original node's data as its first
* argument and with the incoming duplicate node's data as its second
* argument. this could be used, for example, to keep a count with each
@ -70,7 +70,7 @@ static const int avl_bfs[] = {LH, RH};
* NOTE: this routine may malloc memory
*/
int
avl_insert( Avlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
ldap_avl_insert( Avlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
{
Avlnode *t, *p, *s, *q, *r;
int a, cmp, ncmp;
@ -180,7 +180,7 @@ avl_insert( Avlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
}
void*
avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
ldap_avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
{
Avlnode *p, *q, *r, *top;
int side, side_bf, shorter, nside;
@ -207,7 +207,7 @@ avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
if ( p == NULL )
return p;
}
data = p->avl_data;
data = p->avl_data;
/* If this node has two children, swap so we are deleting a node with
* at most one child.
@ -268,7 +268,7 @@ avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
top = NULL;
shorter = 1;
while ( shorter ) {
p = pptr[depth];
side = pdir[depth];
@ -280,7 +280,7 @@ avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
/* Tree is now heavier on opposite side */
p->avl_bf = avl_bfs[nside];
shorter = 0;
} else if ( p->avl_bf == side_bf ) {
/* case 2: taller subtree shortened, height reduced */
p->avl_bf = EH;
@ -358,7 +358,7 @@ avl_inapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
return( AVL_NOMORE );
if ( root->avl_left != 0 )
if ( avl_inapply( root->avl_left, fn, arg, stopflag )
if ( avl_inapply( root->avl_left, fn, arg, stopflag )
== stopflag )
return( stopflag );
@ -378,12 +378,12 @@ avl_postapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
return( AVL_NOMORE );
if ( root->avl_left != 0 )
if ( avl_postapply( root->avl_left, fn, arg, stopflag )
if ( avl_postapply( root->avl_left, fn, arg, stopflag )
== stopflag )
return( stopflag );
if ( root->avl_right != 0 )
if ( avl_postapply( root->avl_right, fn, arg, stopflag )
if ( avl_postapply( root->avl_right, fn, arg, stopflag )
== stopflag )
return( stopflag );
@ -400,7 +400,7 @@ avl_preapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
return( stopflag );
if ( root->avl_left != 0 )
if ( avl_preapply( root->avl_left, fn, arg, stopflag )
if ( avl_preapply( root->avl_left, fn, arg, stopflag )
== stopflag )
return( stopflag );
@ -411,7 +411,7 @@ avl_preapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
}
/*
* avl_apply -- avl tree root is traversed, function fn is called with
* ldap_avl_apply -- avl tree root is traversed, function fn is called with
* arguments arg and the data portion of each node. if fn returns stopflag,
* the traversal is cut short, otherwise it continues. Do not use -6 as
* a stopflag, as this is what is used to indicate the traversal ran out
@ -419,7 +419,7 @@ avl_preapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
*/
int
avl_apply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag, int type )
ldap_avl_apply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag, int type )
{
switch ( type ) {
case AVL_INORDER:
@ -437,18 +437,18 @@ avl_apply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag, int type )
}
/*
* avl_prefixapply - traverse avl tree root, applying function fprefix
* ldap_avl_prefixapply - traverse avl tree root, applying function fprefix
* to any nodes that match. fcmp is called with data as its first arg
* and the current node's data as its second arg. it should return
* 0 if they match, < 0 if data is less, and > 0 if data is greater.
* the idea is to efficiently find all nodes that are prefixes of
* some key... Like avl_apply, this routine also takes a stopflag
* some key... Like ldap_avl_apply, this routine also takes a stopflag
* and will return prematurely if fmatch returns this value. Otherwise,
* AVL_NOMORE is returned.
*/
int
avl_prefixapply(
ldap_avl_prefixapply(
Avlnode *root,
void* data,
AVL_CMP fmatch,
@ -469,23 +469,23 @@ avl_prefixapply(
return( stopflag );
if ( root->avl_left != 0 )
if ( avl_prefixapply( root->avl_left, data, fmatch,
if ( ldap_avl_prefixapply( root->avl_left, data, fmatch,
marg, fcmp, carg, stopflag ) == stopflag )
return( stopflag );
if ( root->avl_right != 0 )
return( avl_prefixapply( root->avl_right, data, fmatch,
return( ldap_avl_prefixapply( root->avl_right, data, fmatch,
marg, fcmp, carg, stopflag ) );
else
return( AVL_NOMORE );
} else if ( cmp < 0 ) {
if ( root->avl_left != 0 )
return( avl_prefixapply( root->avl_left, data, fmatch,
return( ldap_avl_prefixapply( root->avl_left, data, fmatch,
marg, fcmp, carg, stopflag ) );
} else {
if ( root->avl_right != 0 )
return( avl_prefixapply( root->avl_right, data, fmatch,
return( ldap_avl_prefixapply( root->avl_right, data, fmatch,
marg, fcmp, carg, stopflag ) );
}
@ -493,13 +493,13 @@ avl_prefixapply(
}
/*
* avl_free -- traverse avltree root, freeing the memory it is using.
* ldap_avl_free -- traverse avltree root, freeing the memory it is using.
* the dfree() is called to free the data portion of each node. The
* number of items actually freed is returned.
*/
int
avl_free( Avlnode *root, AVL_FREE dfree )
ldap_avl_free( Avlnode *root, AVL_FREE dfree )
{
int nleft, nright;
@ -508,10 +508,10 @@ avl_free( Avlnode *root, AVL_FREE dfree )
nleft = nright = 0;
if ( root->avl_left != 0 )
nleft = avl_free( root->avl_left, dfree );
nleft = ldap_avl_free( root->avl_left, dfree );
if ( root->avl_right != 0 )
nright = avl_free( root->avl_right, dfree );
nright = ldap_avl_free( root->avl_right, dfree );
if ( dfree )
(*dfree)( root->avl_data );
@ -521,14 +521,14 @@ avl_free( Avlnode *root, AVL_FREE dfree )
}
/*
* avl_find -- search avltree root for a node with data data. the function
* cmp is used to compare things. it is called with data as its first arg
* ldap_avl_find -- search avltree root for a node with data data. the function
* cmp is used to compare things. it is called with data as its first arg
* and the current node data as its second. it should return 0 if they match,
* < 0 if arg1 is less than arg2 and > 0 if arg1 is greater than arg2.
*/
Avlnode *
avl_find2( Avlnode *root, const void *data, AVL_CMP fcmp )
ldap_avl_find2( Avlnode *root, const void *data, AVL_CMP fcmp )
{
int cmp;
@ -540,7 +540,7 @@ avl_find2( Avlnode *root, const void *data, AVL_CMP fcmp )
}
void*
avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
ldap_avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
{
int cmp;
@ -553,14 +553,14 @@ avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
}
/*
* avl_find_lin -- search avltree root linearly for a node with data data.
* ldap_avl_find_lin -- search avltree root linearly for a node with data data.
* the function cmp is used to compare things. it is called with data as its
* first arg and the current node data as its second. it should return 0 if
* they match, non-zero otherwise.
*/
void*
avl_find_lin( Avlnode *root, const void* data, AVL_CMP fcmp )
ldap_avl_find_lin( Avlnode *root, const void* data, AVL_CMP fcmp )
{
void* res;
@ -571,21 +571,21 @@ avl_find_lin( Avlnode *root, const void* data, AVL_CMP fcmp )
return( root->avl_data );
if ( root->avl_left != 0 )
if ( (res = avl_find_lin( root->avl_left, data, fcmp ))
if ( (res = ldap_avl_find_lin( root->avl_left, data, fcmp ))
!= NULL )
return( res );
if ( root->avl_right == 0 )
return( NULL );
else
return( avl_find_lin( root->avl_right, data, fcmp ) );
return( ldap_avl_find_lin( root->avl_right, data, fcmp ) );
}
/* NON-REENTRANT INTERFACE */
static void* *avl_list;
static int avl_maxlist;
static int avl_nextlist;
static int ldap_avl_nextlist;
#define AVL_GRABSIZE 100
@ -611,61 +611,61 @@ avl_buildlist( void* data, void* arg )
}
/*
* avl_getfirst() and avl_getnext() are provided as alternate tree
* ldap_avl_getfirst() and ldap_avl_getnext() are provided as alternate tree
* traversal methods, to be used when a single function cannot be
* provided to be called with every node in the tree. avl_getfirst()
* provided to be called with every node in the tree. ldap_avl_getfirst()
* traverses the tree and builds a linear list of all the nodes,
* returning the first node. avl_getnext() returns the next thing
* on the list built by avl_getfirst(). This means that avl_getfirst()
* returning the first node. ldap_avl_getnext() returns the next thing
* on the list built by ldap_avl_getfirst(). This means that ldap_avl_getfirst()
* can take a while, and that the tree should not be messed with while
* being traversed in this way, and that multiple traversals (even of
* different trees) cannot be active at once.
*/
void*
avl_getfirst( Avlnode *root )
ldap_avl_getfirst( Avlnode *root )
{
if ( avl_list ) {
ber_memfree( (char *) avl_list);
avl_list = (void* *) 0;
}
avl_maxlist = 0;
avl_nextlist = 0;
ldap_avl_nextlist = 0;
if ( root == 0 )
return( 0 );
(void) avl_apply( root, avl_buildlist, (void*) 0, -1, AVL_INORDER );
(void) ldap_avl_apply( root, avl_buildlist, (void*) 0, -1, AVL_INORDER );
return( avl_list[ avl_nextlist++ ] );
return( avl_list[ ldap_avl_nextlist++ ] );
}
void*
avl_getnext( void )
ldap_avl_getnext( void )
{
if ( avl_list == 0 )
return( 0 );
if ( avl_nextlist == avl_maxlist ) {
if ( ldap_avl_nextlist == avl_maxlist ) {
ber_memfree( (void*) avl_list);
avl_list = (void* *) 0;
return( 0 );
}
return( avl_list[ avl_nextlist++ ] );
return( avl_list[ ldap_avl_nextlist++ ] );
}
/* end non-reentrant code */
int
avl_dup_error( void* left, void* right )
ldap_avl_dup_error( void* left, void* right )
{
return( -1 );
}
int
avl_dup_ok( void* left, void* right )
ldap_avl_dup_ok( void* left, void* right )
{
return( 0 );
}

View File

@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2005-2021 The OpenLDAP Foundation.
* Copyright 2005-2020 The OpenLDAP Foundation.
* Portions Copyright (c) 2005 by Howard Chu, Symas Corp.
* All rights reserved.
*
@ -34,7 +34,7 @@
#endif
#define AVL_INTERNAL
#include "avl.h"
#include "ldap_avl.h"
/* Maximum tree depth this host's address space could support */
#define MAX_TREE_DEPTH (sizeof(void *) * CHAR_BIT)
@ -45,13 +45,13 @@ static const int avl_bfs[] = {LH, RH};
* Threaded AVL trees - for fast in-order traversal of nodes.
*/
/*
* tavl_insert -- insert a node containing data data into the avl tree
* ldap_tavl_insert -- insert a node containing data data into the avl tree
* with root root. fcmp is a function to call to compare the data portion
* of two nodes. it should take two arguments and return <, >, or == 0,
* depending on whether its first argument is <, >, or == its second
* argument (like strcmp, e.g.). fdup is a function to call when a duplicate
* node is inserted. it should return 0, or -1 and its return value
* will be the return value from avl_insert in the case of a duplicate node.
* will be the return value from ldap_avl_insert in the case of a duplicate node.
* the function will be called with the original node's data as its first
* argument and with the incoming duplicate node's data as its second
* argument. this could be used, for example, to keep a count with each
@ -60,7 +60,7 @@ static const int avl_bfs[] = {LH, RH};
* NOTE: this routine may malloc memory
*/
int
tavl_insert( TAvlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
ldap_tavl_insert( TAvlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
{
TAvlnode *t, *p, *s, *q, *r;
int a, cmp, ncmp;
@ -88,7 +88,7 @@ tavl_insert( TAvlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
return (*fdup)( p->avl_data, data );
cmp = (cmp > 0);
q = avl_child( p, cmp );
q = ldap_avl_child( p, cmp );
if (q == NULL) {
/* insert */
if (( q = (TAvlnode *) ber_memalloc( sizeof( TAvlnode ))) == NULL ) {
@ -187,7 +187,7 @@ tavl_insert( TAvlnode ** root, void *data, AVL_CMP fcmp, AVL_DUP fdup )
}
void*
tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
ldap_tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
{
TAvlnode *p, *q, *r, *top;
int side, side_bf, shorter, nside = -1;
@ -214,7 +214,7 @@ tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
return NULL;
p = p->avl_link[side];
}
data = p->avl_data;
data = p->avl_data;
/* If this node has two children, swap so we are deleting a node with
* at most one child.
@ -313,7 +313,7 @@ tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
top = NULL;
shorter = 1;
while ( shorter ) {
p = pptr[depth];
side = pdir[depth];
@ -325,7 +325,7 @@ tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
/* Tree is now heavier on opposite side */
p->avl_bf = avl_bfs[nside];
shorter = 0;
} else if ( p->avl_bf == side_bf ) {
/* case 2: taller subtree shortened, height reduced */
p->avl_bf = EH;
@ -418,22 +418,22 @@ tavl_delete( TAvlnode **root, void* data, AVL_CMP fcmp )
}
/*
* tavl_free -- traverse avltree root, freeing the memory it is using.
* ldap_tavl_free -- traverse avltree root, freeing the memory it is using.
* the dfree() is called to free the data portion of each node. The
* number of items actually freed is returned.
*/
int
tavl_free( TAvlnode *root, AVL_FREE dfree )
ldap_tavl_free( TAvlnode *root, AVL_FREE dfree )
{
int nleft, nright;
if ( root == 0 )
return( 0 );
nleft = tavl_free( avl_lchild( root ), dfree );
nleft = ldap_tavl_free( ldap_avl_lchild( root ), dfree );
nright = tavl_free( avl_rchild( root ), dfree );
nright = ldap_tavl_free( ldap_avl_rchild( root ), dfree );
if ( dfree )
(*dfree)( root->avl_data );
@ -443,19 +443,19 @@ tavl_free( TAvlnode *root, AVL_FREE dfree )
}
/*
* tavl_find -- search avltree root for a node with data data. the function
* cmp is used to compare things. it is called with data as its first arg
* ldap_tavl_find -- search avltree root for a node with data data. the function
* cmp is used to compare things. it is called with data as its first arg
* and the current node data as its second. it should return 0 if they match,
* < 0 if arg1 is less than arg2 and > 0 if arg1 is greater than arg2.
*/
/*
* tavl_find2 - returns TAvlnode instead of data pointer.
* tavl_find3 - as above, but returns TAvlnode even if no match is found.
* ldap_tavl_find2 - returns TAvlnode instead of data pointer.
* ldap_tavl_find3 - as above, but returns TAvlnode even if no match is found.
* also set *ret = last comparison result, or -1 if root == NULL.
*/
TAvlnode *
tavl_find3( TAvlnode *root, const void *data, AVL_CMP fcmp, int *ret )
ldap_tavl_find3( TAvlnode *root, const void *data, AVL_CMP fcmp, int *ret )
{
int cmp = -1, dir;
TAvlnode *prev = root;
@ -463,32 +463,32 @@ tavl_find3( TAvlnode *root, const void *data, AVL_CMP fcmp, int *ret )
while ( root != 0 && (cmp = (*fcmp)( data, root->avl_data )) != 0 ) {
prev = root;
dir = cmp > 0;
root = avl_child( root, dir );
root = ldap_avl_child( root, dir );
}
*ret = cmp;
return root ? root : prev;
}
TAvlnode *
tavl_find2( TAvlnode *root, const void *data, AVL_CMP fcmp )
ldap_tavl_find2( TAvlnode *root, const void *data, AVL_CMP fcmp )
{
int cmp;
while ( root != 0 && (cmp = (*fcmp)( data, root->avl_data )) != 0 ) {
cmp = cmp > 0;
root = avl_child( root, cmp );
root = ldap_avl_child( root, cmp );
}
return root;
}
void*
tavl_find( TAvlnode *root, const void* data, AVL_CMP fcmp )
ldap_tavl_find( TAvlnode *root, const void* data, AVL_CMP fcmp )
{
int cmp;
while ( root != 0 && (cmp = (*fcmp)( data, root->avl_data )) != 0 ) {
cmp = cmp > 0;
root = avl_child( root, cmp );
root = ldap_avl_child( root, cmp );
}
return( root ? root->avl_data : 0 );
@ -496,7 +496,7 @@ tavl_find( TAvlnode *root, const void* data, AVL_CMP fcmp )
/* Return the leftmost or rightmost node in the tree */
TAvlnode *
tavl_end( TAvlnode *root, int dir )
ldap_tavl_end( TAvlnode *root, int dir )
{
if ( root ) {
while ( root->avl_bits[dir] == AVL_CHILD )
@ -507,7 +507,7 @@ tavl_end( TAvlnode *root, int dir )
/* Return the next node in the given direction */
TAvlnode *
tavl_next( TAvlnode *root, int dir )
ldap_tavl_next( TAvlnode *root, int dir )
{
if ( root ) {
int c = root->avl_bits[dir];

View File

@ -37,7 +37,7 @@
#define AVL_INTERNAL
#define AVL_NONREENTRANT
#include "avl.h"
#include "ldap_avl.h"
static void ravl_print LDAP_P(( Avlnode *root, int depth ));
static void myprint LDAP_P(( Avlnode *root ));
@ -55,7 +55,7 @@ main( int argc, char **argv )
while ( fgets( command, sizeof( command ), stdin ) != NULL ) {
switch( *command ) {
case 'n': /* new tree */
( void ) avl_free( tree, free );
( void ) ldap_avl_free( tree, free );
tree = NULL;
break;
case 'p': /* print */
@ -64,9 +64,9 @@ main( int argc, char **argv )
case 't': /* traverse with first, next */
#ifdef AVL_NONREENTRANT
printf( "***\n" );
for ( p = (char * ) avl_getfirst( tree );
for ( p = (char * ) ldap_avl_getfirst( tree );
p != NULL;
p = (char *) avl_getnext())
p = (char *) ldap_avl_getnext())
printf( "%s\n", p );
printf( "***\n" );
#else
@ -78,7 +78,7 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( (p = (char *) avl_find( tree, name, avl_strcmp ))
if ( (p = (char *) ldap_avl_find( tree, name, avl_strcmp ))
== NULL )
printf( "Not found.\n\n" );
else
@ -89,8 +89,8 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( avl_insert( &tree, strdup( name ), avl_strcmp,
avl_dup_error ) != 0 )
if ( ldap_avl_insert( &tree, strdup( name ), avl_strcmp,
ldap_avl_dup_error ) != 0 )
printf( "\nNot inserted!\n" );
break;
case 'd': /* delete */
@ -98,7 +98,7 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( avl_delete( &tree, name, avl_strcmp ) == NULL )
if ( ldap_avl_delete( &tree, name, avl_strcmp ) == NULL )
printf( "\nNot found!\n" );
break;
case 'q': /* quit */

View File

@ -37,7 +37,7 @@
#include <ac/string.h>
#define AVL_INTERNAL
#include "avl.h"
#include "ldap_avl.h"
static void ravl_print LDAP_P(( TAvlnode *root, int depth, int thread ));
static void myprint LDAP_P(( TAvlnode *root ));
@ -55,7 +55,7 @@ main( int argc, char **argv )
while ( fgets( command, sizeof( command ), stdin ) != NULL ) {
switch( *command ) {
case 'n': /* new tree */
( void ) tavl_free( tree, free );
( void ) ldap_tavl_free( tree, free );
tree = NULL;
break;
case 'p': /* print */
@ -63,9 +63,9 @@ main( int argc, char **argv )
break;
case 't': /* traverse with first, next */
printf( "***\n" );
for ( n = tavl_end( tree, TAVL_DIR_LEFT );
for ( n = ldap_tavl_end( tree, TAVL_DIR_LEFT );
n != NULL;
n = tavl_next( n, TAVL_DIR_RIGHT ))
n = ldap_tavl_next( n, TAVL_DIR_RIGHT ))
printf( "%s\n", n->avl_data );
printf( "***\n" );
break;
@ -74,7 +74,7 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( (p = (char *) tavl_find( tree, name, avl_strcmp ))
if ( (p = (char *) ldap_tavl_find( tree, name, avl_strcmp ))
== NULL )
printf( "Not found.\n\n" );
else
@ -85,8 +85,8 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( tavl_insert( &tree, strdup( name ), avl_strcmp,
avl_dup_error ) != 0 )
if ( ldap_tavl_insert( &tree, strdup( name ), avl_strcmp,
ldap_avl_dup_error ) != 0 )
printf( "\nNot inserted!\n" );
break;
case 'd': /* delete */
@ -94,7 +94,7 @@ main( int argc, char **argv )
if ( fgets( name, sizeof( name ), stdin ) == NULL )
exit( EXIT_SUCCESS );
name[ strlen( name ) - 1 ] = '\0';
if ( tavl_delete( &tree, name, avl_strcmp ) == NULL )
if ( ldap_tavl_delete( &tree, name, avl_strcmp ) == NULL )
printf( "\nNot found!\n" );
break;
case 'q': /* quit */

View File

@ -14,7 +14,6 @@
## <http://www.OpenLDAP.org/license.html>.
LIBRARY = liblutil.a
PROGRAM = testavl
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
@ -29,23 +28,14 @@ XLIBS = $(LIBRARY) $(LDAP_LIBLBER_LA)
SRCS = base64.c entropy.c sasl.c signal.c hash.c passfile.c \
md5.c passwd.c sha1.c getpass.c lockf.c utils.c uuid.c sockpair.c \
avl.c tavl.c \
testavl.c \
meter.c \
@LIBSRCS@ $(@PLAT@_SRCS)
OBJS = base64.o entropy.o sasl.o signal.o hash.o passfile.o \
md5.o passwd.o sha1.o getpass.o lockf.o utils.o uuid.o sockpair.o \
avl.o tavl.o \
meter.o \
@LIBOBJS@ $(@PLAT@_OBJS)
testavl: $(XLIBS) testavl.o
$(LTLINK) -o $@ testavl.o $(LIBS)
testtavl: $(XLIBS) testtavl.o
$(LTLINK) -o $@ testtavl.o $(LIBS)
# These rules are for a Mingw32 build, specifically.
# It's ok for them to be here because the clean rule is harmless, and
# slapdmsg.res won't get built unless it's declared in OBJS.

View File

@ -351,7 +351,7 @@ rewrite_builtin_map_insert(
/*
* May need a mutex?
*/
return avl_insert( &info->li_maps, ( caddr_t )map,
return ldap_avl_insert( &info->li_maps, ( caddr_t )map,
rewrite_builtin_map_cmp,
rewrite_builtin_map_dup );
}
@ -372,7 +372,7 @@ rewrite_builtin_map_find(
tmp.lb_name = ( char * )name;
return ( struct rewrite_builtin_map * )avl_find( info->li_maps,
return ( struct rewrite_builtin_map * )ldap_avl_find( info->li_maps,
( caddr_t )&tmp, rewrite_builtin_map_cmp );
}

View File

@ -85,7 +85,7 @@ rewrite_context_find(
* Fetches the required rewrite context
*/
c.lc_name = (char *)rewriteContext;
context = (struct rewrite_context *)avl_find( info->li_context,
context = (struct rewrite_context *)ldap_avl_find( info->li_context,
(caddr_t)&c, rewrite_context_cmp );
if ( context == NULL ) {
return NULL;
@ -144,7 +144,7 @@ rewrite_context_create(
/*
* Add context to tree
*/
rc = avl_insert( &info->li_context, (caddr_t)context,
rc = ldap_avl_insert( &info->li_context, (caddr_t)context,
rewrite_context_cmp, rewrite_context_dup );
if ( rc == -1 ) {
free( context->lc_rule );

View File

@ -81,13 +81,13 @@ rewrite_info_init(
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( ldap_pvt_thread_rdwr_init( &info->li_cookies_mutex ) ) {
avl_free( info->li_context, rewrite_context_free );
ldap_avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
if ( ldap_pvt_thread_rdwr_init( &info->li_params_mutex ) ) {
ldap_pvt_thread_rdwr_destroy( &info->li_cookies_mutex );
avl_free( info->li_context, rewrite_context_free );
ldap_avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
@ -112,12 +112,12 @@ rewrite_info_delete(
info = *pinfo;
if ( info->li_context ) {
avl_free( info->li_context, rewrite_context_free );
ldap_avl_free( info->li_context, rewrite_context_free );
}
info->li_context = NULL;
if ( info->li_maps ) {
avl_free( info->li_maps, rewrite_builtin_map_free );
ldap_avl_free( info->li_maps, rewrite_builtin_map_free );
}
info->li_maps = NULL;

View File

@ -135,7 +135,7 @@ rewrite_param_destroy(
ldap_pvt_thread_rdwr_wlock( &info->li_params_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
avl_free( info->li_params, rewrite_param_free );
ldap_avl_free( info->li_params, rewrite_param_free );
info->li_params = NULL;
#ifdef USE_REWRITE_LDAP_PVT_THREADS

View File

@ -36,7 +36,7 @@
#define LDAP_DEFINE_LDAP_DEBUG
#include <ldap_log.h>
#include <lutil.h>
#include <avl.h>
#include <ldap_avl.h>
#include <rewrite.h>

View File

@ -88,7 +88,7 @@ rewrite_session_init(
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
tmp.ls_cookie = ( void * )cookie;
session = ( struct rewrite_session * )avl_find( info->li_cookies,
session = ( struct rewrite_session * )ldap_avl_find( info->li_cookies,
( caddr_t )&tmp, rewrite_cookie_cmp );
if ( session ) {
session->ls_count++;
@ -122,7 +122,7 @@ rewrite_session_init(
}
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
rc = avl_insert( &info->li_cookies, ( caddr_t )session,
rc = ldap_avl_insert( &info->li_cookies, ( caddr_t )session,
rewrite_cookie_cmp, rewrite_cookie_dup );
info->li_num_cookies++;
@ -161,7 +161,7 @@ rewrite_session_find(
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_rlock( &info->li_cookies_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
session = ( struct rewrite_session * )avl_find( info->li_cookies,
session = ( struct rewrite_session * )ldap_avl_find( info->li_cookies,
( caddr_t )&tmp, rewrite_cookie_cmp );
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( session ) {
@ -376,7 +376,7 @@ rewrite_session_delete(
* There is nothing to delete in the return value
*/
tmp.ls_cookie = ( void * )cookie;
avl_delete( &info->li_cookies, ( caddr_t )&tmp, rewrite_cookie_cmp );
ldap_avl_delete( &info->li_cookies, ( caddr_t )&tmp, rewrite_cookie_cmp );
free( session );
@ -407,7 +407,7 @@ rewrite_session_destroy(
* Should call per-session destruction routine ...
*/
count = avl_free( info->li_cookies, rewrite_session_free );
count = ldap_avl_free( info->li_cookies, rewrite_session_free );
info->li_cookies = NULL;
#if 0

View File

@ -94,7 +94,7 @@ rewrite_var_delete(
Avlnode *tree
)
{
avl_free( tree, rewrite_var_free );
ldap_avl_free( tree, rewrite_var_free );
return REWRITE_SUCCESS;
}
@ -112,7 +112,7 @@ rewrite_var_find(
assert( name != NULL );
var.lv_name = ( char * )name;
return ( struct rewrite_var * )avl_find( tree,
return ( struct rewrite_var * )ldap_avl_find( tree,
( caddr_t )&var, rewrite_var_cmp );
}
@ -223,12 +223,12 @@ rewrite_var_insert_f(
var->lv_value.bv_val = (char *)value;
}
var->lv_value.bv_len = strlen( value );
rc = avl_insert( tree, ( caddr_t )var,
rc = ldap_avl_insert( tree, ( caddr_t )var,
rewrite_var_cmp, rewrite_var_dup );
cleanup:;
if ( rc != 0 && var ) {
avl_delete( tree, ( caddr_t )var, rewrite_var_cmp );
ldap_avl_delete( tree, ( caddr_t )var, rewrite_var_cmp );
rewrite_var_free( var );
var = NULL;
}

View File

@ -207,7 +207,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
client->c_connid, pin );
pinned_op =
tavl_delete( &client->c_ops, &needle, operation_client_cmp );
ldap_tavl_delete( &client->c_ops, &needle, operation_client_cmp );
if ( pinned_op ) {
assert( op->o_tag == pinned_op->o_tag );
@ -225,12 +225,12 @@ request_bind( LloadConnection *client, LloadOperation *op )
/* No one has seen this operation yet, plant the pin back in its stead */
client->c_n_ops_executing--;
op->o_res = LLOAD_OP_COMPLETED;
tavl_delete( &client->c_ops, op, operation_client_cmp );
ldap_tavl_delete( &client->c_ops, op, operation_client_cmp );
op->o_client = NULL;
assert( op->o_upstream == NULL );
rc = tavl_insert( &client->c_ops, pinned_op, operation_client_cmp,
avl_dup_error );
rc = ldap_tavl_insert( &client->c_ops, pinned_op, operation_client_cmp,
ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
/* No one has seen this operation yet */
@ -244,7 +244,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
}
}
tavl_delete( &client->c_ops, op, operation_client_cmp );
ldap_tavl_delete( &client->c_ops, op, operation_client_cmp );
client->c_n_ops_executing--;
client_reset( client );
@ -326,7 +326,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
goto fail;
}
rc = tavl_insert( &client->c_ops, op, operation_client_cmp, avl_dup_error );
rc = ldap_tavl_insert( &client->c_ops, op, operation_client_cmp, ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
client->c_n_ops_executing++;
CONNECTION_UNLOCK(client);
@ -413,7 +413,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
}
if ( pin ) {
tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
ldap_tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
if ( tag == LDAP_AUTH_SIMPLE ) {
pin = op->o_pin_id = 0;
}
@ -468,8 +468,8 @@ request_bind( LloadConnection *client, LloadOperation *op )
"added bind from client connid=%lu to upstream connid=%lu "
"as msgid=%d\n",
op->o_client_connid, op->o_upstream_connid, op->o_upstream_msgid );
if ( tavl_insert( &upstream->c_ops, op, operation_upstream_cmp,
avl_dup_error ) ) {
if ( ldap_tavl_insert( &upstream->c_ops, op, operation_upstream_cmp,
ldap_avl_dup_error ) ) {
assert(0);
}
upstream->c_state = LLOAD_C_BINDING;
@ -527,7 +527,7 @@ finish_sasl_bind(
int rc;
CONNECTION_ASSERT_LOCKED(upstream);
removed = tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
removed = ldap_tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
if ( !removed ) {
assert( upstream->c_state != LLOAD_C_BINDING );
/* FIXME: has client replaced this bind since? */
@ -563,8 +563,8 @@ finish_sasl_bind(
op->o_ber = ber;
/* Could we have been unlinked in the meantime? */
rc = tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, avl_dup_error );
rc = ldap_tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
CONNECTION_UNLOCK(upstream);
@ -623,7 +623,7 @@ handle_bind_response(
}
CONNECTION_LOCK(upstream);
if ( !tavl_find( upstream->c_ops, op, operation_upstream_cmp ) ) {
if ( !ldap_tavl_find( upstream->c_ops, op, operation_upstream_cmp ) ) {
/*
* operation might not be found because:
* - it has timed out (only happens when debugging/hung/...)
@ -658,10 +658,10 @@ handle_bind_response(
op->o_pin_id = 0;
} else if ( result == LDAP_SASL_BIND_IN_PROGRESS ) {
tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
ldap_tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
op->o_upstream_msgid = 0;
rc = tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, avl_dup_error );
rc = ldap_tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
} else {
int sasl_finished = 0;
@ -687,7 +687,7 @@ handle_bind_response(
}
CONNECTION_LOCK(client);
removed = tavl_delete( &client->c_ops, op, operation_client_cmp );
removed = ldap_tavl_delete( &client->c_ops, op, operation_client_cmp );
assert( !removed || op == removed );
if ( client->c_state == LLOAD_C_BINDING ) {
@ -696,8 +696,8 @@ handle_bind_response(
case LDAP_SASL_BIND_IN_PROGRESS:
op->o_saved_msgid = op->o_client_msgid;
op->o_client_msgid = 0;
rc = tavl_insert( &client->c_ops, op, operation_client_cmp,
avl_dup_error );
rc = ldap_tavl_insert( &client->c_ops, op, operation_client_cmp,
ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
break;
case LDAP_SUCCESS:
@ -813,7 +813,7 @@ handle_whoami_response(
}
}
removed = tavl_delete( &client->c_ops, op, operation_client_cmp );
removed = ldap_tavl_delete( &client->c_ops, op, operation_client_cmp );
assert( !removed || op == removed );
op->o_pin_id = 0;
if ( removed ) {

View File

@ -51,7 +51,7 @@ request_abandon( LloadConnection *c, LloadOperation *op )
}
CONNECTION_LOCK(c);
request = tavl_find( c->c_ops, &needle, operation_client_cmp );
request = ldap_tavl_find( c->c_ops, &needle, operation_client_cmp );
if ( !request ) {
Debug( LDAP_DEBUG_STATS, "request_abandon: "
"connid=%lu msgid=%d requests abandon of an operation "
@ -152,8 +152,8 @@ request_process( LloadConnection *client, LloadOperation *op )
upstream->c_pendingber = output;
op->o_upstream_msgid = msgid = upstream->c_next_msgid++;
rc = tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, avl_dup_error );
rc = ldap_tavl_insert(
&upstream->c_ops, op, operation_upstream_cmp, ldap_avl_dup_error );
CONNECTION_UNLOCK(upstream);
Debug( LDAP_DEBUG_TRACE, "request_process: "
@ -505,7 +505,7 @@ client_reset( LloadConnection *c )
CONNECTION_UNLOCK(c);
if ( root ) {
freed = tavl_free( root, (AVL_FREE)operation_abandon );
freed = ldap_tavl_free( root, (AVL_FREE)operation_abandon );
Debug( LDAP_DEBUG_TRACE, "client_reset: "
"dropped %ld operations\n",
freed );

View File

@ -526,7 +526,7 @@ lload_connection_close( LloadConnection *c, void *arg )
c->c_state = LLOAD_C_CLOSING;
do {
TAvlnode *node = tavl_end( c->c_ops, TAVL_DIR_LEFT );
TAvlnode *node = ldap_tavl_end( c->c_ops, TAVL_DIR_LEFT );
op = node->avl_data;
/* Close operations that would need client action to resolve,

View File

@ -38,7 +38,7 @@ handle_starttls( LloadConnection *c, LloadOperation *op )
int rc = LDAP_SUCCESS;
CONNECTION_LOCK(c);
found = tavl_delete( &c->c_ops, op, operation_client_cmp );
found = ldap_tavl_delete( &c->c_ops, op, operation_client_cmp );
assert( op == found );
c->c_n_ops_executing--;
@ -138,7 +138,7 @@ request_extended( LloadConnection *c, LloadOperation *op )
needle.oid = bv;
handler = avl_find( lload_exop_handlers, &needle, exop_handler_cmp );
handler = ldap_avl_find( lload_exop_handlers, &needle, exop_handler_cmp );
if ( handler ) {
Debug( LDAP_DEBUG_TRACE, "request_extended: "
"handling exop OID %.*s internally\n",
@ -174,8 +174,8 @@ lload_register_exop_handlers( struct lload_exop_handlers_t *handler )
Debug( LDAP_DEBUG_TRACE, "lload_register_exop_handlers: "
"registering handler for exop oid=%s\n",
handler->oid.bv_val );
if ( avl_insert( &lload_exop_handlers, handler, exop_handler_cmp,
avl_dup_error ) ) {
if ( ldap_avl_insert( &lload_exop_handlers, handler, exop_handler_cmp,
ldap_avl_dup_error ) ) {
Debug( LDAP_DEBUG_ANY, "lload_register_exop_handlers: "
"failed to register handler for exop oid=%s\n",
handler->oid.bv_val );

View File

@ -40,7 +40,7 @@
#include <ac/time.h>
#include <ac/param.h>
#include "avl.h"
#include "ldap_avl.h"
#include "../servers/slapd/slap.h"
#include "../slapd/back-monitor/back-monitor.h"

View File

@ -903,7 +903,7 @@ stop:
if ( global_host ) ch_free( global_host );
/* kludge, get symbols referenced */
tavl_free( NULL, NULL );
ldap_tavl_free( NULL, NULL );
MAIN_RETURN(rc);
}

View File

@ -151,7 +151,7 @@ operation_init( LloadConnection *c, BerElement *ber )
}
CONNECTION_ASSERT_LOCKED(c);
rc = tavl_insert( &c->c_ops, op, operation_client_cmp, avl_dup_error );
rc = ldap_tavl_insert( &c->c_ops, op, operation_client_cmp, ldap_avl_dup_error );
if ( rc ) {
Debug( LDAP_DEBUG_PACKETS, "operation_init: "
"several operations with same msgid=%d in-flight "
@ -167,7 +167,7 @@ operation_init( LloadConnection *c, BerElement *ber )
break;
}
if ( rc ) {
tavl_delete( &c->c_ops, op, operation_client_cmp );
ldap_tavl_delete( &c->c_ops, op, operation_client_cmp );
goto fail;
}
@ -269,7 +269,7 @@ operation_unlink_client( LloadOperation *op, LloadConnection *client )
op, op->o_client_msgid, op->o_client_connid );
CONNECTION_LOCK(client);
if ( (removed = tavl_delete(
if ( (removed = ldap_tavl_delete(
&client->c_ops, op, operation_client_cmp )) ) {
result = LLOAD_OP_DETACHING_CLIENT;
@ -312,7 +312,7 @@ operation_unlink_upstream( LloadOperation *op, LloadConnection *upstream )
op, op->o_upstream_msgid, op->o_upstream_connid );
CONNECTION_LOCK(upstream);
if ( (removed = tavl_delete(
if ( (removed = ldap_tavl_delete(
&upstream->c_ops, op, operation_upstream_cmp )) ) {
result |= LLOAD_OP_DETACHING_UPSTREAM;
@ -525,13 +525,13 @@ connection_timeout( LloadConnection *upstream, void *arg )
int rc, nops = 0;
CONNECTION_LOCK(upstream);
for ( node = tavl_end( upstream->c_ops, TAVL_DIR_LEFT ); node &&
for ( node = ldap_tavl_end( upstream->c_ops, TAVL_DIR_LEFT ); node &&
((LloadOperation *)node->avl_data)->o_start <
threshold; /* shortcut */
node = next ) {
LloadOperation *found_op;
next = tavl_next( node, TAVL_DIR_RIGHT );
next = ldap_tavl_next( node, TAVL_DIR_RIGHT );
op = node->avl_data;
/* Have we received another response since? */
@ -540,7 +540,7 @@ connection_timeout( LloadConnection *upstream, void *arg )
}
op->o_res = LLOAD_OP_FAILED;
found_op = tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
found_op = ldap_tavl_delete( &upstream->c_ops, op, operation_upstream_cmp );
assert( op == found_op );
if ( upstream->c_state == LLOAD_C_BINDING ) {
@ -552,7 +552,7 @@ connection_timeout( LloadConnection *upstream, void *arg )
}
}
rc = tavl_insert( &ops, op, operation_upstream_cmp, avl_dup_error );
rc = ldap_tavl_insert( &ops, op, operation_upstream_cmp, ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
Debug( LDAP_DEBUG_STATS2, "connection_timeout: "
@ -579,8 +579,8 @@ connection_timeout( LloadConnection *upstream, void *arg )
b->b_n_ops_executing -= nops;
checked_unlock( &b->b_mutex );
for ( node = tavl_end( ops, TAVL_DIR_LEFT ); node;
node = tavl_next( node, TAVL_DIR_RIGHT ) ) {
for ( node = ldap_tavl_end( ops, TAVL_DIR_LEFT ); node;
node = ldap_tavl_next( node, TAVL_DIR_RIGHT ) ) {
op = node->avl_data;
operation_send_reject( op,
@ -607,7 +607,7 @@ connection_timeout( LloadConnection *upstream, void *arg )
}
/* just dispose of the AVL, most operations should already be gone */
tavl_free( ops, NULL );
ldap_tavl_free( ops, NULL );
return LDAP_SUCCESS;
}

View File

@ -183,7 +183,7 @@ handle_one_response( LloadConnection *c )
CONNECTION_LOCK(c);
if ( needle.o_upstream_msgid == 0 ) {
return handle_unsolicited( c, ber );
} else if ( !( op = tavl_find(
} else if ( !( op = ldap_tavl_find(
c->c_ops, &needle, operation_upstream_cmp ) ) ) {
/* Already abandoned, do nothing */
CONNECTION_UNLOCK(c);
@ -1008,7 +1008,7 @@ upstream_unlink( LloadConnection *c )
CONNECTION_UNLOCK(c);
freed = tavl_free( root, (AVL_FREE)operation_lost_upstream );
freed = ldap_tavl_free( root, (AVL_FREE)operation_lost_upstream );
assert( freed == executing );
/*

View File

@ -123,18 +123,18 @@ at_bvfind( struct berval *name )
struct aindexrec *air;
if ( attr_cache ) {
air = avl_find( attr_cache, name, attr_index_name_cmp );
air = ldap_avl_find( attr_cache, name, attr_index_name_cmp );
if ( air ) return air->air_at;
}
air = avl_find( attr_index, name, attr_index_name_cmp );
air = ldap_avl_find( attr_index, name, attr_index_name_cmp );
if ( air ) {
if ( air->air_at->sat_flags & SLAP_AT_DELETED ) {
air = NULL;
} else if (( slapMode & SLAP_TOOL_MODE ) && at_oc_cache ) {
avl_insert( &attr_cache, (caddr_t) air,
attr_index_cmp, avl_dup_error );
ldap_avl_insert( &attr_cache, (caddr_t) air,
attr_index_cmp, ldap_avl_dup_error );
}
}
@ -239,7 +239,7 @@ at_delete_names( AttributeType *at )
ber_str2bv( *names, 0, 0, &tmpair.air_name );
tmpair.air_at = at;
air = (struct aindexrec *)avl_delete( &attr_index,
air = (struct aindexrec *)ldap_avl_delete( &attr_index,
(caddr_t)&tmpair, attr_index_cmp );
assert( air != NULL );
ldap_memfree( air );
@ -325,7 +325,7 @@ at_destroy( void )
at_delete_names( a );
}
avl_free(attr_index, at_destroy_one);
ldap_avl_free(attr_index, at_destroy_one);
if ( slap_schema.si_at_undefined ) {
ad_destroy(slap_schema.si_at_undefined->sat_ad);
@ -451,7 +451,7 @@ at_insert(
air->air_at = sat;
air_old = NULL;
if ( avl_insert( &attr_index, (caddr_t) air,
if ( ldap_avl_insert( &attr_index, (caddr_t) air,
attr_index_cmp, at_dup_error ) )
{
AttributeType *old_sat;
@ -515,8 +515,8 @@ at_insert(
ch_calloc( 1, sizeof(struct aindexrec) );
ber_str2bv( *names, 0, 0, &air->air_name );
air->air_at = sat;
if ( avl_insert( &attr_index, (caddr_t) air,
attr_index_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &attr_index, (caddr_t) air,
attr_index_cmp, ldap_avl_dup_error ) )
{
AttributeType *old_sat;
int rc;
@ -535,7 +535,7 @@ at_insert(
names--;
ber_str2bv( *names, 0, 0, &tmpair.air_name );
tmpair.air_at = sat;
air = (struct aindexrec *)avl_delete( &attr_index,
air = (struct aindexrec *)ldap_avl_delete( &attr_index,
(caddr_t)&tmpair, attr_index_cmp );
assert( air != NULL );
ldap_memfree( air );
@ -546,7 +546,7 @@ at_insert(
ber_str2bv( sat->sat_oid, 0, 0, &tmpair.air_name );
tmpair.air_at = sat;
air = (struct aindexrec *)avl_delete( &attr_index,
air = (struct aindexrec *)ldap_avl_delete( &attr_index,
(caddr_t)&tmpair, attr_index_cmp );
assert( air != NULL );
ldap_memfree( air );
@ -973,7 +973,7 @@ static void
at_index_print( void )
{
printf("Printing attribute type index:\n");
(void) avl_apply( attr_index, at_index_printnode, 0, -1, AVL_INORDER );
(void) ldap_avl_apply( attr_index, at_index_printnode, 0, -1, AVL_INORDER );
}
#endif
#endif

View File

@ -101,7 +101,7 @@ asyncmeta_dncache_get_target(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = ( metadncacheentry_t * )avl_find( cache->tree,
entry = ( metadncacheentry_t * )ldap_avl_find( cache->tree,
( caddr_t )&tmp_entry, asyncmeta_dncache_cmp );
if ( entry != NULL ) {
@ -157,7 +157,7 @@ asyncmeta_dncache_update_entry(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = ( metadncacheentry_t * )avl_find( cache->tree,
entry = ( metadncacheentry_t * )ldap_avl_find( cache->tree,
( caddr_t )&tmp_entry, asyncmeta_dncache_cmp );
if ( entry != NULL ) {
@ -179,7 +179,7 @@ asyncmeta_dncache_update_entry(
entry->target = target;
entry->lastupdated = curr_time;
err = avl_insert( &cache->tree, ( caddr_t )entry,
err = ldap_avl_insert( &cache->tree, ( caddr_t )entry,
asyncmeta_dncache_cmp, asyncmeta_dncache_dup );
}
@ -203,7 +203,7 @@ asyncmeta_dncache_delete_entry(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = avl_delete( &cache->tree, ( caddr_t )&tmp_entry,
entry = ldap_avl_delete( &cache->tree, ( caddr_t )&tmp_entry,
asyncmeta_dncache_cmp );
ldap_pvt_thread_mutex_unlock( &cache->mutex );

View File

@ -432,7 +432,7 @@ asyncmeta_back_db_destroy(
ldap_pvt_thread_mutex_lock( &mi->mi_cache.mutex );
if ( mi->mi_cache.tree ) {
avl_free( mi->mi_cache.tree, asyncmeta_dncache_free );
ldap_avl_free( mi->mi_cache.tree, asyncmeta_dncache_free );
}
ldap_pvt_thread_mutex_unlock( &mi->mi_cache.mutex );

View File

@ -118,10 +118,10 @@ ldap_back_print_conntree( ldapinfo_t *li, char *msg )
fprintf( stderr, "\t(empty)\n" );
} else {
TAvlnode *edge = tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
TAvlnode *edge = ldap_tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
ldap_back_conn_print( (ldapconn_t *)edge->avl_data );
edge = tavl_next( edge, TAVL_DIR_RIGHT );
edge = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
}
}
@ -179,7 +179,7 @@ ldap_back_conn_delete( ldapinfo_t *li, ldapconn_t *lc )
if ( LDAP_BACK_CONN_CACHED( lc ) ) {
assert( !LDAP_BACK_CONN_TAINTED( lc ) );
tmplc = tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)lc,
tmplc = ldap_tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)lc,
ldap_back_conndnlc_cmp );
assert( tmplc == lc );
LDAP_BACK_CONN_CACHED_CLEAR( lc );
@ -333,7 +333,7 @@ retry_lock:;
/* delete all cached connections with the current connection */
if ( LDAP_BACK_SINGLECONN( li ) ) {
while ( ( tmplc = tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)lc, ldap_back_conn_cmp ) ) != NULL )
while ( ( tmplc = ldap_tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)lc, ldap_back_conn_cmp ) ) != NULL )
{
assert( !LDAP_BACK_PCONN_ISPRIV( lc ) );
Debug( LDAP_DEBUG_TRACE,
@ -361,7 +361,7 @@ retry_lock:;
if ( be_isroot_dn( op->o_bd, &op->o_req_ndn ) ) {
LDAP_BACK_PCONN_ROOTDN_SET( lc, op );
}
lerr = tavl_insert( &li->li_conninfo.lai_tree, (caddr_t)lc,
lerr = ldap_tavl_insert( &li->li_conninfo.lai_tree, (caddr_t)lc,
ldap_back_conndn_cmp, ldap_back_conndn_dup );
}
@ -924,7 +924,7 @@ retry_lock:
} else {
/* Searches for a ldapconn in the avl tree */
lc = (ldapconn_t *)tavl_find( li->li_conninfo.lai_tree,
lc = (ldapconn_t *)ldap_tavl_find( li->li_conninfo.lai_tree,
(caddr_t)&lc_curr, ldap_back_conndn_cmp );
}
@ -1070,7 +1070,7 @@ retry_lock:
rs->sr_err = 0;
} else {
rs->sr_err = tavl_insert( &li->li_conninfo.lai_tree, (caddr_t)lc,
rs->sr_err = ldap_tavl_insert( &li->li_conninfo.lai_tree, (caddr_t)lc,
ldap_back_conndn_cmp, ldap_back_conndn_dup );
LDAP_BACK_CONN_CACHED_SET( lc );
}
@ -3111,9 +3111,9 @@ ldap_back_conn_prune( ldapinfo_t *li )
}
}
edge = tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapconn_t *lc = (ldapconn_t *)edge->avl_data;
time_t conn_expires = ldap_back_conn_expire_time( li, lc );

View File

@ -564,7 +564,7 @@ Document: RFC 4511
/* Searches for a ldapinfo in the avl tree */
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
lip = (ldapinfo_t *)tavl_find( lc->lc_lai.lai_tree,
lip = (ldapinfo_t *)ldap_tavl_find( lc->lc_lai.lai_tree,
(caddr_t)&li, ldap_chain_uri_cmp );
ldap_pvt_thread_mutex_unlock( &lc->lc_lai.lai_mutex );
@ -596,7 +596,7 @@ Document: RFC 4511
if ( LDAP_CHAIN_CACHE_URI( lc ) ) {
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
if ( tavl_insert( &lc->lc_lai.lai_tree,
if ( ldap_tavl_insert( &lc->lc_lai.lai_tree,
(caddr_t)lip, ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
{
/* someone just inserted another;
@ -836,7 +836,7 @@ ldap_chain_search(
/* Searches for a ldapinfo in the avl tree */
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
lip = (ldapinfo_t *)tavl_find( lc->lc_lai.lai_tree,
lip = (ldapinfo_t *)ldap_tavl_find( lc->lc_lai.lai_tree,
(caddr_t)&li, ldap_chain_uri_cmp );
ldap_pvt_thread_mutex_unlock( &lc->lc_lai.lai_mutex );
@ -869,7 +869,7 @@ ldap_chain_search(
if ( LDAP_CHAIN_CACHE_URI( lc ) ) {
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
if ( tavl_insert( &lc->lc_lai.lai_tree,
if ( ldap_tavl_insert( &lc->lc_lai.lai_tree,
(caddr_t)lip, ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
{
/* someone just inserted another;
@ -1408,7 +1408,7 @@ fail:
li->li_uri = ch_strdup( at->a_vals[ 0 ].bv_val );
value_add_one( &li->li_bvuri, &at->a_vals[ 0 ] );
if ( tavl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
if ( ldap_tavl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
{
Debug( LDAP_DEBUG_ANY, "slapd-chain: "
@ -1468,9 +1468,9 @@ chain_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca )
ldap_chain_cfadd_apply( lc->lc_common_li, op, rs, p, ca, count++ );
edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
ldap_chain_cfadd_apply( li, op, rs, p, ca, count++ );
edge = next;
@ -1494,8 +1494,8 @@ chain_lddel( CfEntryInfo *ce, Operation *op )
ldapinfo_t *li = (ldapinfo_t *) ce->ce_be->be_private;
if ( li != lc->lc_common_li ) {
if (! tavl_delete( &lc->lc_lai.lai_tree, li, ldap_chain_uri_cmp ) ) {
Debug( LDAP_DEBUG_ANY, "slapd-chain: avl_delete failed. "
if (! ldap_tavl_delete( &lc->lc_lai.lai_tree, li, ldap_chain_uri_cmp ) ) {
Debug( LDAP_DEBUG_ANY, "slapd-chain: ldap_avl_delete failed. "
"\"%s\" not found.\n", li->li_uri );
return -1;
}
@ -1903,7 +1903,7 @@ private_destroy:;
goto private_destroy;
}
if ( tavl_insert( &lc->lc_lai.lai_tree,
if ( ldap_tavl_insert( &lc->lc_lai.lai_tree,
(caddr_t)lc->lc_cfg_li,
ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
{
@ -1955,9 +1955,9 @@ ldap_chain_db_func(
}
if ( lc->lc_lai.lai_tree != NULL ) {
TAvlnode *edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
TAvlnode *edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
db.be_private = (void *)li;
rc = func( &db, NULL );
@ -2032,7 +2032,7 @@ ldap_chain_db_destroy(
rc = ldap_chain_db_func( be, db_destroy );
if ( lc ) {
tavl_free( lc->lc_lai.lai_tree, NULL );
ldap_tavl_free( lc->lc_lai.lai_tree, NULL );
ldap_pvt_thread_mutex_destroy( &lc->lc_lai.lai_mutex );
ch_free( lc );
}
@ -2160,9 +2160,9 @@ ldap_chain_connection_destroy(
be->be_private = NULL;
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
be->be_private = (void *)li;
rc = lback->bi_connection_destroy( be, conn );

View File

@ -1387,7 +1387,7 @@ ldap_back_cf_gen( ConfigArgs *c )
/* NOTE: don't worry about locking: if we got here,
* other threads are suspended. */
if ( li->li_conninfo.lai_tree != NULL ) {
tavl_free( li->li_conninfo.lai_tree, ldap_back_conn_free );
ldap_tavl_free( li->li_conninfo.lai_tree, ldap_back_conn_free );
li->li_conninfo.lai_tree = NULL;
}

View File

@ -432,7 +432,7 @@ distproc_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca )
if ( lc->lc_common_li == NULL ) {
lc->lc_common_li = li;
} else if ( tavl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
} else if ( ldap_tavl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
ldap_distproc_uri_cmp, ldap_distproc_uri_dup ) )
{
Debug( LDAP_DEBUG_ANY, "slapd-distproc: "
@ -504,9 +504,9 @@ distproc_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca )
ldap_distproc_cfadd_apply( lc->lc_common_li, op, rs, p, ca, count++ );
edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
ldap_distproc_cfadd_apply( li, op, rs, p, ca, count++ );
edge = next;
@ -680,7 +680,7 @@ private_destroy:;
goto private_destroy;
}
if ( tavl_insert( &lc->lc_lai.lai_tree,
if ( ldap_tavl_insert( &lc->lc_lai.lai_tree,
(caddr_t)lc->lc_cfg_li,
ldap_distproc_uri_cmp, ldap_distproc_uri_dup ) )
{
@ -732,9 +732,9 @@ ldap_distproc_db_func(
}
if ( lc->lc_lai.lai_tree != NULL ) {
TAvlnode *edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
TAvlnode *edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
be->be_private = (void *)li;
rc = func( &db, NULL );
@ -779,7 +779,7 @@ ldap_distproc_db_destroy(
rc = ldap_distproc_db_func( be, db_destroy );
if ( lc ) {
tavl_free( lc->lc_lai.lai_tree, NULL );
ldap_tavl_free( lc->lc_lai.lai_tree, NULL );
ldap_pvt_thread_mutex_destroy( &lc->lc_lai.lai_mutex );
ch_free( lc );
}
@ -863,9 +863,9 @@ ldap_distproc_connection_destroy(
be->be_private = NULL;
ldap_pvt_thread_mutex_lock( &lc->lc_lai.lai_mutex );
edge = tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( lc->lc_lai.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapinfo_t *li = (ldapinfo_t *)edge->avl_data;
be->be_private = (void *)li;
rc = lback->bi_connection_destroy( be, conn );

View File

@ -336,7 +336,7 @@ ldap_back_db_destroy( Backend *be, ConfigReply *cr )
li->li_idassert_authz = NULL;
}
if ( li->li_conninfo.lai_tree ) {
tavl_free( li->li_conninfo.lai_tree, ldap_back_conn_free );
ldap_tavl_free( li->li_conninfo.lai_tree, ldap_back_conn_free );
}
for ( i = LDAP_BACK_PCONN_FIRST; i < LDAP_BACK_PCONN_LAST; i++ ) {
while ( !LDAP_TAILQ_EMPTY( &li->li_conn_priv[ i ].lic_priv ) ) {

View File

@ -565,9 +565,9 @@ ldap_back_monitor_conn_create(
}
}
edge = tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
edge = ldap_tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
while ( edge ) {
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
ldapconn_t *lc = (ldapconn_t *)edge->avl_data;
ldap_back_monitor_conn_entry( lc, arg );
edge = next;

View File

@ -51,7 +51,7 @@ ldap_back_conn_destroy(
#if LDAP_BACK_PRINT_CONNTREE > 0
ldap_back_print_conntree( li, ">>> ldap_back_conn_destroy" );
#endif /* LDAP_BACK_PRINT_CONNTREE */
while ( ( lc = tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)&lc_curr, ldap_back_conn_cmp ) ) != NULL )
while ( ( lc = ldap_tavl_delete( &li->li_conninfo.lai_tree, (caddr_t)&lc_curr, ldap_back_conn_cmp ) ) != NULL )
{
assert( !LDAP_BACK_PCONN_ISPRIV( lc ) );
Debug( LDAP_DEBUG_TRACE,

View File

@ -601,7 +601,7 @@ mdb_monitor_db_destroy( BackendDB *be )
/* TODO: free tree */
ldap_pvt_thread_mutex_destroy( &mdb->mi_idx_mutex );
avl_free( mdb->mi_idx, ch_free );
ldap_avl_free( mdb->mi_idx, ch_free );
#endif /* MDB_MONITOR_IDX */
return 0;
@ -690,14 +690,14 @@ mdb_monitor_idx_add(
ldap_pvt_thread_mutex_lock( &mdb->mi_idx_mutex );
idx = (monitor_idx_t *)avl_find( mdb->mi_idx,
idx = (monitor_idx_t *)ldap_avl_find( mdb->mi_idx,
(caddr_t)&idx_dummy, monitor_idx_cmp );
if ( idx == NULL ) {
idx = (monitor_idx_t *)ch_calloc( sizeof( monitor_idx_t ), 1 );
idx->idx_ad = desc;
idx->idx_count[ key ] = 1;
switch ( avl_insert( &mdb->mi_idx, (caddr_t)idx,
switch ( ldap_avl_insert( &mdb->mi_idx, (caddr_t)idx,
monitor_idx_cmp, monitor_idx_dup ) )
{
case 0:
@ -777,7 +777,7 @@ mdb_monitor_idx_entry_add(
ldap_pvt_thread_mutex_lock( &mdb->mi_idx_mutex );
avl_apply( mdb->mi_idx, mdb_monitor_idx_apply,
ldap_avl_apply( mdb->mi_idx, mdb_monitor_idx_apply,
&vals, -1, AVL_INORDER );
ldap_pvt_thread_mutex_unlock( &mdb->mi_idx_mutex );

View File

@ -1370,12 +1370,12 @@ mdb_tool_idl_flush_db( MDB_txn *txn, AttrInfo *ai, AttrIxInfo *ax )
int rc;
mdb_cursor_open( txn, ai->ai_dbi, &mc );
root = tavl_end( ai->ai_root, TAVL_DIR_LEFT );
root = ldap_tavl_end( ai->ai_root, TAVL_DIR_LEFT );
do {
rc = mdb_tool_idl_flush_one( mc, ax, root->avl_data );
if ( rc != -1 )
rc = 0;
} while ((root = tavl_next(root, TAVL_DIR_RIGHT)));
} while ((root = ldap_tavl_next(root, TAVL_DIR_RIGHT)));
mdb_cursor_close( mc );
return rc;
@ -1391,7 +1391,7 @@ mdb_tool_idl_flush( BackendDB *be, MDB_txn *txn )
for ( i=0; i < mdb->mi_nattrs; i++ ) {
if ( !mdb->mi_attrs[i]->ai_root ) continue;
rc = mdb_tool_idl_flush_db( txn, mdb->mi_attrs[i], mdb_tool_axinfo[i % mdb_tool_threads] );
tavl_free(mdb->mi_attrs[i]->ai_root, NULL);
ldap_tavl_free(mdb->mi_attrs[i]->ai_root, NULL);
mdb->mi_attrs[i]->ai_root = NULL;
if ( rc )
break;
@ -1416,7 +1416,7 @@ int mdb_tool_idl_add(
dbi = ai->ai_dbi;
for (i=0; keys[i].bv_val; i++) {
itmp.kstr = keys[i];
ic = tavl_find( ai->ai_root, &itmp, mdb_tool_idl_cmp );
ic = ldap_tavl_find( ai->ai_root, &itmp, mdb_tool_idl_cmp );
/* No entry yet, create one */
if ( !ic ) {
@ -1438,8 +1438,8 @@ int mdb_tool_idl_add(
ic->count = 0;
ic->offset = 0;
ic->flags = 0;
tavl_insert( &ai->ai_root, ic, mdb_tool_idl_cmp,
avl_dup_error );
ldap_tavl_insert( &ai->ai_root, ic, mdb_tool_idl_cmp,
ldap_avl_dup_error );
/* load existing key count here */
key.mv_size = keys[i].bv_len;

View File

@ -212,7 +212,7 @@ meta_back_bind( Operation *op, SlapReply *rs )
if ( LDAP_BACK_SINGLECONN( mi ) ) {
metaconn_t *tmpmc;
while ( ( tmpmc = tavl_delete( &mi->mi_conninfo.lai_tree, (caddr_t)mc, meta_back_conn_cmp ) ) != NULL )
while ( ( tmpmc = ldap_tavl_delete( &mi->mi_conninfo.lai_tree, (caddr_t)mc, meta_back_conn_cmp ) ) != NULL )
{
assert( !LDAP_BACK_PCONN_ISPRIV( mc ) );
Debug( LDAP_DEBUG_TRACE,
@ -235,7 +235,7 @@ meta_back_bind( Operation *op, SlapReply *rs )
}
ber_bvreplace( &mc->mc_local_ndn, &op->o_req_ndn );
lerr = tavl_insert( &mi->mi_conninfo.lai_tree, (caddr_t)mc,
lerr = ldap_tavl_insert( &mi->mi_conninfo.lai_tree, (caddr_t)mc,
meta_back_conndn_cmp, meta_back_conndn_dup );
#if META_BACK_PRINT_CONNTREE > 0
meta_back_print_conntree( mi, "<<< meta_back_bind" );

View File

@ -3073,8 +3073,8 @@ ldap_back_map_config(
}
}
if ( (src[ 0 ] != '\0' && avl_find( map->map, (caddr_t)&mapping[ 0 ], mapping_cmp ) != NULL)
|| avl_find( map->remap, (caddr_t)&mapping[ 1 ], mapping_cmp ) != NULL)
if ( (src[ 0 ] != '\0' && ldap_avl_find( map->map, (caddr_t)&mapping[ 0 ], mapping_cmp ) != NULL)
|| ldap_avl_find( map->remap, (caddr_t)&mapping[ 1 ], mapping_cmp ) != NULL)
{
snprintf( c->cr_msg, sizeof( c->cr_msg ),
"duplicate mapping found." );
@ -3083,10 +3083,10 @@ ldap_back_map_config(
}
if ( src[ 0 ] != '\0' ) {
avl_insert( &map->map, (caddr_t)&mapping[ 0 ],
ldap_avl_insert( &map->map, (caddr_t)&mapping[ 0 ],
mapping_cmp, mapping_dup );
}
avl_insert( &map->remap, (caddr_t)&mapping[ 1 ],
ldap_avl_insert( &map->remap, (caddr_t)&mapping[ 1 ],
mapping_cmp, mapping_dup );
success_return:;

View File

@ -830,7 +830,7 @@ meta_back_retry(
} else {
/* FIXME: check if in tree, for consistency? */
(void)tavl_delete( &mi->mi_conninfo.lai_tree,
(void)ldap_tavl_delete( &mi->mi_conninfo.lai_tree,
( caddr_t )mc, meta_back_conndnmc_cmp );
}
LDAP_BACK_CONN_CACHED_CLEAR( mc );
@ -1155,7 +1155,7 @@ retry_lock:;
} else {
mc = (metaconn_t *)tavl_find( mi->mi_conninfo.lai_tree,
mc = (metaconn_t *)ldap_tavl_find( mi->mi_conninfo.lai_tree,
(caddr_t)&mc_curr, meta_back_conndn_cmp );
}
@ -1200,7 +1200,7 @@ retry_lock:;
}
} else {
(void)tavl_delete( &mi->mi_conninfo.lai_tree,
(void)ldap_tavl_delete( &mi->mi_conninfo.lai_tree,
(caddr_t)mc, meta_back_conndnmc_cmp );
}
@ -1420,7 +1420,7 @@ retry_lock:;
if ( !( sendok & LDAP_BACK_BINDING ) ) {
retry_lock2:;
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
mc = (metaconn_t *)tavl_find( mi->mi_conninfo.lai_tree,
mc = (metaconn_t *)ldap_tavl_find( mi->mi_conninfo.lai_tree,
(caddr_t)&mc_curr, meta_back_conndn_cmp );
if ( mc != NULL ) {
/* catch taint errors */
@ -1669,7 +1669,7 @@ done:;
rs->sr_err = 0;
} else if ( !( sendok & LDAP_BACK_BINDING ) ) {
err = tavl_insert( &mi->mi_conninfo.lai_tree, ( caddr_t )mc,
err = ldap_tavl_insert( &mi->mi_conninfo.lai_tree, ( caddr_t )mc,
meta_back_conndn_cmp, meta_back_conndn_dup );
LDAP_BACK_CONN_CACHED_SET( mc );
}
@ -1786,7 +1786,7 @@ meta_back_release_conn_lock(
} else if ( LDAP_BACK_CONN_CACHED( mc ) ) {
metaconn_t *tmpmc;
tmpmc = tavl_delete( &mi->mi_conninfo.lai_tree,
tmpmc = ldap_tavl_delete( &mi->mi_conninfo.lai_tree,
( caddr_t )mc, meta_back_conndnmc_cmp );
/* Overparanoid, but useful... */

View File

@ -101,7 +101,7 @@ meta_dncache_get_target(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = ( metadncacheentry_t * )avl_find( cache->tree,
entry = ( metadncacheentry_t * )ldap_avl_find( cache->tree,
( caddr_t )&tmp_entry, meta_dncache_cmp );
if ( entry != NULL ) {
@ -157,7 +157,7 @@ meta_dncache_update_entry(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = ( metadncacheentry_t * )avl_find( cache->tree,
entry = ( metadncacheentry_t * )ldap_avl_find( cache->tree,
( caddr_t )&tmp_entry, meta_dncache_cmp );
if ( entry != NULL ) {
@ -179,7 +179,7 @@ meta_dncache_update_entry(
entry->target = target;
entry->lastupdated = curr_time;
err = avl_insert( &cache->tree, ( caddr_t )entry,
err = ldap_avl_insert( &cache->tree, ( caddr_t )entry,
meta_dncache_cmp, meta_dncache_dup );
}
@ -209,7 +209,7 @@ meta_dncache_delete_entry(
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
entry = avl_delete( &cache->tree, ( caddr_t )&tmp_entry,
entry = ldap_avl_delete( &cache->tree, ( caddr_t )&tmp_entry,
meta_dncache_cmp );
ldap_pvt_thread_mutex_unlock( &cache->mutex );

View File

@ -320,8 +320,8 @@ mapping_dst_free(
void
meta_back_map_free( struct ldapmap *lm )
{
avl_free( lm->remap, mapping_dst_free );
avl_free( lm->map, mapping_free );
ldap_avl_free( lm->remap, mapping_dst_free );
ldap_avl_free( lm->map, mapping_free );
lm->remap = NULL;
lm->map = NULL;
}
@ -405,7 +405,7 @@ meta_back_db_destroy(
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
if ( mi->mi_conninfo.lai_tree ) {
tavl_free( mi->mi_conninfo.lai_tree, meta_back_conn_free );
ldap_tavl_free( mi->mi_conninfo.lai_tree, meta_back_conn_free );
}
for ( i = LDAP_BACK_PCONN_FIRST; i < LDAP_BACK_PCONN_LAST; i++ ) {
while ( !LDAP_TAILQ_EMPTY( &mi->mi_conn_priv[ i ].mic_priv ) ) {
@ -441,7 +441,7 @@ meta_back_db_destroy(
ldap_pvt_thread_mutex_lock( &mi->mi_cache.mutex );
if ( mi->mi_cache.tree ) {
avl_free( mi->mi_cache.tree, meta_dncache_free );
ldap_avl_free( mi->mi_cache.tree, meta_dncache_free );
}
ldap_pvt_thread_mutex_unlock( &mi->mi_cache.mutex );

View File

@ -100,9 +100,9 @@ ldap_back_map_init ( struct ldapmap *lm, struct ldapmapping **m )
mapping[1].src = mapping[0].src;
mapping[1].dst = mapping[0].dst;
avl_insert( &lm->map, (caddr_t)&mapping[0],
ldap_avl_insert( &lm->map, (caddr_t)&mapping[0],
mapping_cmp, mapping_dup );
avl_insert( &lm->remap, (caddr_t)&mapping[1],
ldap_avl_insert( &lm->remap, (caddr_t)&mapping[1],
mapping_cmp, mapping_dup );
*m = mapping;
}
@ -133,7 +133,7 @@ ldap_back_mapping ( struct ldapmap *map, struct berval *s, struct ldapmapping **
}
fmapping.src = *s;
*m = (struct ldapmapping *)avl_find( tree, (caddr_t)&fmapping, mapping_cmp );
*m = (struct ldapmapping *)ldap_avl_find( tree, (caddr_t)&fmapping, mapping_cmp );
if ( *m == NULL ) {
return map->drop_missing;
}

View File

@ -54,7 +54,7 @@ meta_back_conn_destroy(
#if META_BACK_PRINT_CONNTREE > 0
meta_back_print_conntree( mi, ">>> meta_back_conn_destroy" );
#endif /* META_BACK_PRINT_CONNTREE */
while ( ( mc = tavl_delete( &mi->mi_conninfo.lai_tree, ( caddr_t )&mc_curr, meta_back_conn_cmp ) ) != NULL )
while ( ( mc = ldap_tavl_delete( &mi->mi_conninfo.lai_tree, ( caddr_t )&mc_curr, meta_back_conn_cmp ) ) != NULL )
{
assert( !LDAP_BACK_PCONN_ISPRIV( mc ) );
Debug( LDAP_DEBUG_TRACE,

View File

@ -24,7 +24,7 @@
#include <ldap_pvt.h>
#include <ldap_pvt_thread.h>
#include <avl.h>
#include <ldap_avl.h>
#include <slap.h>
LDAP_BEGIN_DECL

View File

@ -91,7 +91,7 @@ monitor_cache_add(
mc->mc_ndn = e->e_nname;
mc->mc_e = e;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
rc = avl_insert( &mi->mi_cache, ( caddr_t )mc,
rc = ldap_avl_insert( &mi->mi_cache, ( caddr_t )mc,
monitor_cache_cmp, monitor_cache_dup );
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
@ -153,7 +153,7 @@ monitor_cache_get(
tmp_mc.mc_ndn = *ndn;
retry:;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
mc = ( monitor_cache_t * )ldap_avl_find( mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
if ( mc != NULL ) {
@ -196,7 +196,7 @@ retry:;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
tmp_mc.mc_ndn = *ndn;
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
mc = ( monitor_cache_t * )ldap_avl_find( mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
if ( mc != NULL ) {
@ -208,7 +208,7 @@ retry:;
}
tmp_mc.mc_ndn = pndn;
pmc = ( monitor_cache_t * )avl_find( mi->mi_cache,
pmc = ( monitor_cache_t * )ldap_avl_find( mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
if ( pmc != NULL ) {
monitor_entry_t *mp = (monitor_entry_t *)mc->mc_e->e_private,
@ -248,7 +248,7 @@ retry:;
monitor_cache_t *tmpmc;
tmp_mc.mc_ndn = *ndn;
tmpmc = avl_delete( &mi->mi_cache,
tmpmc = ldap_avl_delete( &mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
assert( tmpmc == mc );
@ -367,7 +367,7 @@ monitor_cache_release(
/* volatile entries do not return to cache */
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
tmp_mc.mc_ndn = e->e_nname;
mc = avl_delete( &mi->mi_cache,
mc = ldap_avl_delete( &mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
if ( mc != NULL ) {
@ -430,7 +430,7 @@ monitor_cache_destroy(
monitor_info_t *mi )
{
if ( mi->mi_cache ) {
avl_free( mi->mi_cache, monitor_entry_destroy );
ldap_avl_free( mi->mi_cache, monitor_entry_destroy );
}
return 0;

View File

@ -68,7 +68,7 @@ backsql_delete_all_attrs(
bda.dbh = dbh;
bda.e_id = eid;
rc = avl_apply( eid->eid_oc->bom_attrs, backsql_delete_attr_f, &bda,
rc = ldap_avl_apply( eid->eid_oc->bom_attrs, backsql_delete_attr_f, &bda,
BACKSQL_AVL_STOP, AVL_INORDER );
if ( rc == BACKSQL_AVL_STOP ) {
return rs->sr_err;
@ -95,7 +95,7 @@ backsql_delete_int(
sth = *sthp;
/* avl_apply ... */
/* ldap_avl_apply ... */
rs->sr_err = backsql_delete_all_attrs( op, rs, dbh, eid );
if ( rs->sr_err != LDAP_SUCCESS ) {
goto done;

View File

@ -949,7 +949,7 @@ backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *eid )
{
Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): "
"retrieving all attributes\n" );
avl_apply( bsi->bsi_oc->bom_attrs, backsql_get_attr_vals,
ldap_avl_apply( bsi->bsi_oc->bom_attrs, backsql_get_attr_vals,
bsi, 0, AVL_INORDER );
} else {

View File

@ -267,7 +267,7 @@ backsql_add_sysmaps( backsql_info *bi, backsql_oc_map_rec *oc_map )
at_map->bam_next = NULL;
backsql_make_attr_query( bi, oc_map, at_map );
if ( avl_insert( &oc_map->bom_attrs, at_map, backsql_cmp_attr, backsql_dup_attr ) == BACKSQL_DUPLICATE ) {
if ( ldap_avl_insert( &oc_map->bom_attrs, at_map, backsql_cmp_attr, backsql_dup_attr ) == BACKSQL_DUPLICATE ) {
Debug( LDAP_DEBUG_TRACE, "backsql_add_sysmaps(): "
"duplicate attribute \"%s\" in objectClass \"%s\" map\n",
at_map->bam_ad->ad_cname.bv_val,
@ -450,7 +450,7 @@ backsql_oc_get_attr_mapping( void *v_oc, void *v_bas )
"preconstructed query \"%s\"\n",
at_map->bam_query );
at_map->bam_next = NULL;
if ( avl_insert( &oc_map->bom_attrs, at_map, backsql_cmp_attr, backsql_dup_attr ) == BACKSQL_DUPLICATE ) {
if ( ldap_avl_insert( &oc_map->bom_attrs, at_map, backsql_cmp_attr, backsql_dup_attr ) == BACKSQL_DUPLICATE ) {
Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_attr_mapping(): "
"duplicate attribute \"%s\" "
"in objectClass \"%s\" map\n",
@ -652,14 +652,14 @@ backsql_load_schema_map( backsql_info *bi, SQLHDBC dbh )
*/
oc_map->bom_attrs = NULL;
if ( avl_insert( &bi->sql_oc_by_oc, oc_map, backsql_cmp_oc, avl_dup_error ) == -1 ) {
if ( ldap_avl_insert( &bi->sql_oc_by_oc, oc_map, backsql_cmp_oc, ldap_avl_dup_error ) == -1 ) {
Debug( LDAP_DEBUG_TRACE, "backsql_load_schema_map(): "
"duplicate objectClass \"%s\" in objectClass map\n",
oc_map->bom_oc->soc_cname.bv_val );
ch_free( oc_map );
return LDAP_OTHER;
}
if ( avl_insert( &bi->sql_oc_by_id, oc_map, backsql_cmp_oc_id, avl_dup_error ) == -1 ) {
if ( ldap_avl_insert( &bi->sql_oc_by_id, oc_map, backsql_cmp_oc_id, ldap_avl_dup_error ) == -1 ) {
Debug( LDAP_DEBUG_TRACE, "backsql_load_schema_map(): "
"duplicate objectClass \"%s\" in objectClass by ID map\n",
oc_map->bom_oc->soc_cname.bv_val );
@ -723,7 +723,7 @@ backsql_load_schema_map( backsql_info *bi, SQLHDBC dbh )
bas.bas_oc_id = &oc_id;
bas.bas_rc = LDAP_SUCCESS;
(void)avl_apply( bi->sql_oc_by_oc, backsql_oc_get_attr_mapping,
(void)ldap_avl_apply( bi->sql_oc_by_oc, backsql_oc_get_attr_mapping,
&bas, BACKSQL_AVL_STOP, AVL_INORDER );
SQLFreeStmt( sth, SQL_DROP );
@ -747,7 +747,7 @@ backsql_oc2oc( backsql_info *bi, ObjectClass *oc )
#endif /* BACKSQL_TRACE */
tmp.bom_oc = oc;
res = (backsql_oc_map_rec *)avl_find( bi->sql_oc_by_oc, &tmp, backsql_cmp_oc );
res = (backsql_oc_map_rec *)ldap_avl_find( bi->sql_oc_by_oc, &tmp, backsql_cmp_oc );
#ifdef BACKSQL_TRACE
if ( res != NULL ) {
Debug( LDAP_DEBUG_TRACE, "<==backsql_oc2oc(): "
@ -778,7 +778,7 @@ backsql_name2oc( backsql_info *bi, struct berval *oc_name )
return NULL;
}
res = (backsql_oc_map_rec *)avl_find( bi->sql_oc_by_oc, &tmp, backsql_cmp_oc );
res = (backsql_oc_map_rec *)ldap_avl_find( bi->sql_oc_by_oc, &tmp, backsql_cmp_oc );
#ifdef BACKSQL_TRACE
if ( res != NULL ) {
Debug( LDAP_DEBUG_TRACE, "<==oc_with_name(): "
@ -804,7 +804,7 @@ backsql_id2oc( backsql_info *bi, unsigned long id )
#endif /* BACKSQL_TRACE */
tmp.bom_id = id;
res = (backsql_oc_map_rec *)avl_find( bi->sql_oc_by_id, &tmp,
res = (backsql_oc_map_rec *)ldap_avl_find( bi->sql_oc_by_id, &tmp,
backsql_cmp_oc_id );
#ifdef BACKSQL_TRACE
@ -833,7 +833,7 @@ backsql_ad2at( backsql_oc_map_rec* objclass, AttributeDescription *ad )
#endif /* BACKSQL_TRACE */
tmp.bam_ad = ad;
res = (backsql_at_map_rec *)avl_find( objclass->bom_attrs, &tmp,
res = (backsql_at_map_rec *)ldap_avl_find( objclass->bom_attrs, &tmp,
backsql_cmp_attr );
#ifdef BACKSQL_TRACE
@ -921,7 +921,7 @@ backsql_supad2at( backsql_oc_map_rec *objclass, AttributeDescription *supad,
va.ad = supad;
rc = avl_apply( objclass->bom_attrs, supad2at_f, &va,
rc = ldap_avl_apply( objclass->bom_attrs, supad2at_f, &va,
SUPAD2AT_STOP, AVL_INORDER );
if ( rc == SUPAD2AT_STOP ) {
return -1;
@ -983,7 +983,7 @@ backsql_free_oc( void *v_oc )
Debug( LDAP_DEBUG_TRACE, "==>free_oc(): \"%s\"\n",
BACKSQL_OC_NAME( oc ) );
avl_free( oc->bom_attrs, backsql_free_attr );
ldap_avl_free( oc->bom_attrs, backsql_free_attr );
ch_free( oc->bom_keytbl.bv_val );
ch_free( oc->bom_keycol.bv_val );
if ( oc->bom_create_proc != NULL ) {
@ -1004,8 +1004,8 @@ int
backsql_destroy_schema_map( backsql_info *bi )
{
Debug( LDAP_DEBUG_TRACE, "==>destroy_schema_map()\n" );
avl_free( bi->sql_oc_by_oc, 0 );
avl_free( bi->sql_oc_by_id, backsql_free_oc );
ldap_avl_free( bi->sql_oc_by_oc, 0 );
ldap_avl_free( bi->sql_oc_by_id, backsql_free_oc );
Debug( LDAP_DEBUG_TRACE, "<==destroy_schema_map()\n" );
return 0;
}

View File

@ -2181,7 +2181,7 @@ backsql_search( Operation *op, SlapReply *rs )
* of entries matching LDAP query filter and scope (or at least
* candidates), and get the IDs. Do this in ID order for paging.
*/
avl_apply( bi->sql_oc_by_id, backsql_oc_get_candidates,
ldap_avl_apply( bi->sql_oc_by_id, backsql_oc_get_candidates,
&bsi, BACKSQL_AVL_STOP, AVL_INORDER );
/* check for abandon */

View File

@ -4591,7 +4591,7 @@ config_register_schema(ConfigTable *ct, ConfigOCs *ocs) {
ocs[i].co_name = &ocs[i].co_oc->soc_cname;
if ( !ocs[i].co_table )
ocs[i].co_table = ct;
avl_insert( &CfOcTree, &ocs[i], CfOc_cmp, avl_dup_error );
ldap_avl_insert( &CfOcTree, &ocs[i], CfOc_cmp, ldap_avl_dup_error );
}
}
return 0;
@ -5181,7 +5181,7 @@ count_oc( ObjectClass *oc, ConfigOCs ***copp, int *nocs )
}
co.co_name = &oc->soc_cname;
cop = avl_find( CfOcTree, &co, CfOc_cmp );
cop = ldap_avl_find( CfOcTree, &co, CfOc_cmp );
if ( cop ) {
int i;
@ -5392,7 +5392,7 @@ config_add_oc( ConfigOCs **cop, CfEntryInfo *last, Entry *e, ConfigArgs *ca )
ConfigOCs co = { 0 };
co.co_name = &(*ocp)->soc_cname;
*cop = avl_find( CfOcTree, &co, CfOc_cmp );
*cop = ldap_avl_find( CfOcTree, &co, CfOc_cmp );
if ( *cop == NULL ) {
return rc;
}
@ -5527,7 +5527,7 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs,
ca->ca_op = op;
co.co_name = &soc_at->a_nvals[0];
coptr = avl_find( CfOcTree, &co, CfOc_cmp );
coptr = ldap_avl_find( CfOcTree, &co, CfOc_cmp );
if ( coptr == NULL ) {
Debug( LDAP_DEBUG_TRACE, "%s: config_add_internal: "
"DN=\"%s\" no structural objectClass in configuration table\n",
@ -6666,7 +6666,7 @@ config_back_delete( Operation *op, SlapReply *rs )
}
for ( i=0; !BER_BVISNULL(&oc_at->a_nvals[i]); i++ ) {
co.co_name = &oc_at->a_nvals[i];
coptr = avl_find( CfOcTree, &co, CfOc_cmp );
coptr = ldap_avl_find( CfOcTree, &co, CfOc_cmp );
if ( coptr == NULL || coptr->co_type != Cft_Misc ) {
continue;
}
@ -7540,7 +7540,7 @@ config_back_db_destroy( BackendDB *be, ConfigReply *cr )
ch_free( cfdir.bv_val );
avl_free( CfOcTree, NULL );
ldap_avl_free( CfOcTree, NULL );
if ( cfb->cb_db.bd_info ) {
cfb->cb_db.be_suffix = NULL;

View File

@ -73,7 +73,7 @@ cr_bvfind( struct berval *crname )
{
struct cindexrec *cir;
cir = avl_find( cr_index, crname, cr_index_name_cmp );
cir = ldap_avl_find( cr_index, crname, cr_index_name_cmp );
if ( cir != NULL ) {
return( cir->cir_cr );
@ -101,7 +101,7 @@ cr_destroy( void )
{
ContentRule *c;
avl_free(cr_index, ldap_memfree);
ldap_avl_free(cr_index, ldap_memfree);
while( !LDAP_STAILQ_EMPTY(&cr_list) ) {
c = LDAP_STAILQ_FIRST(&cr_list);
@ -129,8 +129,8 @@ cr_insert(
cir->cir_name.bv_len = strlen( scr->scr_oid );
cir->cir_cr = scr;
if ( avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, ldap_avl_dup_error ) )
{
*err = scr->scr_oid;
ldap_memfree(cir);
@ -149,8 +149,8 @@ cr_insert(
cir->cir_name.bv_len = strlen( *names );
cir->cir_cr = scr;
if ( avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, ldap_avl_dup_error ) )
{
*err = *names;
ldap_memfree(cir);

View File

@ -1129,7 +1129,7 @@ stop:
ch_free( global_host );
/* kludge, get symbols referenced */
tavl_free( NULL, NULL );
ldap_tavl_free( NULL, NULL );
#ifdef CSRIMALLOC
mal_dumpleaktrace( leakfile );

View File

@ -76,7 +76,7 @@ mr_bvfind( struct berval *mrname )
{
struct mindexrec *mir = NULL;
if ( (mir = avl_find( mr_index, mrname, mr_index_name_cmp )) != NULL ) {
if ( (mir = ldap_avl_find( mr_index, mrname, mr_index_name_cmp )) != NULL ) {
return( mir->mir_mr );
}
return( NULL );
@ -87,7 +87,7 @@ mr_destroy( void )
{
MatchingRule *m;
avl_free(mr_index, ldap_memfree);
ldap_avl_free(mr_index, ldap_memfree);
while( !LDAP_SLIST_EMPTY(&mr_list) ) {
m = LDAP_SLIST_FIRST(&mr_list);
LDAP_SLIST_REMOVE_HEAD(&mr_list, smr_next);
@ -115,8 +115,8 @@ mr_insert(
mir->mir_name.bv_val = smr->smr_oid;
mir->mir_name.bv_len = strlen( smr->smr_oid );
mir->mir_mr = smr;
if ( avl_insert( &mr_index, (caddr_t) mir,
mr_index_cmp, avl_dup_error ) ) {
if ( ldap_avl_insert( &mr_index, (caddr_t) mir,
mr_index_cmp, ldap_avl_dup_error ) ) {
*err = smr->smr_oid;
ldap_memfree(mir);
return SLAP_SCHERR_MR_DUP;
@ -131,8 +131,8 @@ mr_insert(
mir->mir_name.bv_val = *names;
mir->mir_name.bv_len = strlen( *names );
mir->mir_mr = smr;
if ( avl_insert( &mr_index, (caddr_t) mir,
mr_index_cmp, avl_dup_error ) ) {
if ( ldap_avl_insert( &mr_index, (caddr_t) mir,
mr_index_cmp, ldap_avl_dup_error ) ) {
*err = *names;
ldap_memfree(mir);
return SLAP_SCHERR_MR_DUP;

View File

@ -180,15 +180,15 @@ oc_bvfind( struct berval *ocname )
struct oindexrec *oir;
if ( oc_cache ) {
oir = avl_find( oc_cache, ocname, oc_index_name_cmp );
oir = ldap_avl_find( oc_cache, ocname, oc_index_name_cmp );
if ( oir ) return oir->oir_oc;
}
oir = avl_find( oc_index, ocname, oc_index_name_cmp );
oir = ldap_avl_find( oc_index, ocname, oc_index_name_cmp );
if ( oir != NULL ) {
if ( at_oc_cache ) {
avl_insert( &oc_cache, (caddr_t) oir,
oc_index_cmp, avl_dup_error );
ldap_avl_insert( &oc_cache, (caddr_t) oir,
oc_index_cmp, ldap_avl_dup_error );
}
return( oir->oir_oc );
}
@ -407,7 +407,7 @@ oc_delete_names( ObjectClass *oc )
ber_str2bv( *names, 0, 0, &tmpoir.oir_name );
tmpoir.oir_oc = oc;
oir = (struct oindexrec *)avl_delete( &oc_index,
oir = (struct oindexrec *)ldap_avl_delete( &oc_index,
(caddr_t)&tmpoir, oc_index_cmp );
assert( oir != NULL );
ldap_memfree( oir );
@ -472,7 +472,7 @@ oc_destroy( void )
oc_delete_names( o );
}
avl_free( oc_index, oc_destroy_one );
ldap_avl_free( oc_index, oc_destroy_one );
while( !LDAP_STAILQ_EMPTY(&oc_undef_list) ) {
o = LDAP_STAILQ_FIRST(&oc_undef_list);
@ -597,7 +597,7 @@ oc_insert(
oir->oir_oc = soc;
oir_old = NULL;
if ( avl_insert( &oc_index, (caddr_t) oir,
if ( ldap_avl_insert( &oc_index, (caddr_t) oir,
oc_index_cmp, oc_dup_error ) )
{
ObjectClass *old_soc;
@ -649,8 +649,8 @@ oc_insert(
oir->oir_name.bv_len = strlen( *names );
oir->oir_oc = soc;
if ( avl_insert( &oc_index, (caddr_t) oir,
oc_index_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &oc_index, (caddr_t) oir,
oc_index_cmp, ldap_avl_dup_error ) )
{
ObjectClass *old_soc;
int rc;
@ -669,7 +669,7 @@ oc_insert(
names--;
ber_str2bv( *names, 0, 0, &tmpoir.oir_name );
tmpoir.oir_oc = soc;
oir = (struct oindexrec *)avl_delete( &oc_index,
oir = (struct oindexrec *)ldap_avl_delete( &oc_index,
(caddr_t)&tmpoir, oc_index_cmp );
assert( oir != NULL );
ldap_memfree( oir );
@ -680,7 +680,7 @@ oc_insert(
ber_str2bv( soc->soc_oid, 0, 0, &tmpoir.oir_name );
tmpoir.oir_oc = soc;
oir = (struct oindexrec *)avl_delete( &oc_index,
oir = (struct oindexrec *)ldap_avl_delete( &oc_index,
(caddr_t)&tmpoir, oc_index_cmp );
assert( oir != NULL );
ldap_memfree( oir );

View File

@ -382,8 +382,8 @@ dynlist_nested_memberOf( Entry *e, AttributeDescription *ad, TAvlnode *sups )
Attribute *a;
a = attr_find( e->e_attrs, ad );
for ( ptr = tavl_end( sups, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( sups, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
dyn = ptr->avl_data;
if ( a ) {
unsigned slot;
@ -447,10 +447,10 @@ dynlist_nested_member( Operation *op, dynlist_member_t *dm, TAvlnode *subs )
if ( !a )
return;
for ( ptr = tavl_end( subs, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( subs, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
dyn = ptr->avl_data;
if ( tavl_insert( &dm->dm_groups, dyn, dynlist_ptr_cmp, avl_dup_error ))
if ( ldap_tavl_insert( &dm->dm_groups, dyn, dynlist_ptr_cmp, ldap_avl_dup_error ))
continue;
if ( overlay_entry_get_ov( op, &dyn->dy_name, NULL, NULL, 0, &ne, on ) != LDAP_SUCCESS || ne == NULL )
continue;
@ -764,7 +764,7 @@ checkdyn:
dm.dm_ad = dlm->dlm_member_ad;
dynlist_nested_member( op, &dm, dyn->dy_subs );
if ( dm.dm_groups )
tavl_free( dm.dm_groups, NULL );
ldap_tavl_free( dm.dm_groups, NULL );
}
}
}
@ -1089,7 +1089,7 @@ dynlist_search1resp( Operation *op, SlapReply *rs )
if ( b )
dyn->dy_staticmember = ds->ds_dlm->dlm_member_ad;
if ( tavl_insert( &ds->ds_names, dyn, dynlist_avl_cmp, avl_dup_error )) {
if ( ldap_tavl_insert( &ds->ds_names, dyn, dynlist_avl_cmp, ldap_avl_dup_error )) {
for (i=dyn->dy_numuris-1; i>=0; i--) {
ludp = dyn->dy_uris[i];
if ( ludp->lud_filter ) {
@ -1243,7 +1243,7 @@ dynlist_filter_group( Operation *op, dynlist_name_t *dyn, Filter *n, dynlist_sea
Attribute *a;
int rc = -1;
if ( tavl_insert( &ds->ds_fnodes, dyn, dynlist_ptr_cmp, avl_dup_error ))
if ( ldap_tavl_insert( &ds->ds_fnodes, dyn, dynlist_ptr_cmp, ldap_avl_dup_error ))
return 0;
if ( overlay_entry_get_ov( op, &dyn->dy_name, NULL, NULL, 0, &e, on ) !=
@ -1264,8 +1264,8 @@ dynlist_filter_group( Operation *op, dynlist_name_t *dyn, Filter *n, dynlist_sea
overlay_entry_release_ov( op, e, 0, on );
if ( dyn->dy_subs && !rc ) {
TAvlnode *ptr;
for ( ptr = tavl_end( dyn->dy_subs, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( dyn->dy_subs, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
dyn = ptr->avl_data;
rc = dynlist_filter_group( op, dyn, n, ds );
if ( rc )
@ -1300,7 +1300,7 @@ dynlist_filter_dup( Operation *op, Filter *f, AttributeDescription *ad, dynlist_
case LDAP_FILTER_EQUALITY:
n->f_choice = SLAPD_FILTER_COMPUTED;
if ( f->f_av_desc == ad ) {
dynlist_name_t *dyn = tavl_find( ds->ds_names, &f->f_av_value, dynlist_avl_cmp );
dynlist_name_t *dyn = ldap_tavl_find( ds->ds_names, &f->f_av_value, dynlist_avl_cmp );
if ( dyn && !dynlist_filter_group( op, dyn, n, ds ))
break;
}
@ -1380,9 +1380,9 @@ dynlist_search_free( void *ptr )
ldap_free_urldesc( ludp );
}
if ( dyn->dy_subs )
tavl_free( dyn->dy_subs, NULL );
ldap_tavl_free( dyn->dy_subs, NULL );
if ( dyn->dy_sups )
tavl_free( dyn->dy_sups, NULL );
ldap_tavl_free( dyn->dy_sups, NULL );
ch_free( ptr );
}
@ -1393,9 +1393,9 @@ dynlist_search_cleanup( Operation *op, SlapReply *rs )
rs->sr_err == SLAPD_ABANDON ) {
slap_callback *sc = op->o_callback;
dynlist_search_t *ds = op->o_callback->sc_private;
tavl_free( ds->ds_names, dynlist_search_free );
ldap_tavl_free( ds->ds_names, dynlist_search_free );
if ( ds->ds_fnodes )
tavl_free( ds->ds_fnodes, NULL );
ldap_tavl_free( ds->ds_fnodes, NULL );
if ( ds->ds_origfilter ) {
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
dynlist_filter_free( op, op->ors_filter );
@ -1472,8 +1472,8 @@ dynlist_add_memberOf(Operation *op, SlapReply *rs, dynlist_search_t *ds)
Attribute *a;
/* See if there are any memberOf values to attach to this entry */
for ( ptr = tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
dynlist_map_t *dlm;
dyn = ptr->avl_data;
for ( dlm = dyn->dy_dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
@ -1520,7 +1520,7 @@ dynlist_search2resp( Operation *op, SlapReply *rs )
if ( rs->sr_type == REP_SEARCH && rs->sr_entry != NULL ) {
rc = SLAP_CB_CONTINUE;
/* See if this is one of our dynamic entries */
dyn = tavl_find( ds->ds_names, &rs->sr_entry->e_nname, dynlist_avl_cmp );
dyn = ldap_tavl_find( ds->ds_names, &rs->sr_entry->e_nname, dynlist_avl_cmp );
if ( dyn ) {
dyn->dy_seen = 1;
rc = dynlist_prepare_entry( op, rs, dyn->dy_dli, dyn );
@ -1542,8 +1542,8 @@ dynlist_search2resp( Operation *op, SlapReply *rs )
/* Check for any unexpanded dynamic group entries that weren't picked up
* by the original search filter.
*/
for ( ptr = tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
dyn = ptr->avl_data;
if ( dyn->dy_seen )
continue;
@ -1599,13 +1599,13 @@ dynlist_nestlink_dg( Operation *op, SlapReply *rs )
if ( rs->sr_type != REP_SEARCH )
return LDAP_SUCCESS;
dj = tavl_find( dll->dl_ds->ds_names, &rs->sr_entry->e_nname, dynlist_avl_cmp );
dj = ldap_tavl_find( dll->dl_ds->ds_names, &rs->sr_entry->e_nname, dynlist_avl_cmp );
if ( dj ) {
if ( ds->ds_want & WANT_MEMBEROF ) {
tavl_insert( &dj->dy_sups, di, dynlist_ptr_cmp, avl_dup_error );
ldap_tavl_insert( &dj->dy_sups, di, dynlist_ptr_cmp, ldap_avl_dup_error );
}
if ( ds->ds_want & WANT_MEMBER ) {
tavl_insert( &di->dy_subs, dj, dynlist_ptr_cmp, avl_dup_error );
ldap_tavl_insert( &di->dy_subs, dj, dynlist_ptr_cmp, ldap_avl_dup_error );
}
}
return LDAP_SUCCESS;
@ -1622,8 +1622,8 @@ dynlist_nestlink( Operation *op, dynlist_search_t *ds )
Attribute *a;
int i;
for ( ptr = tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = tavl_next( ptr, TAVL_DIR_RIGHT )) {
for ( ptr = ldap_tavl_end( ds->ds_names, TAVL_DIR_LEFT ); ptr;
ptr = ldap_tavl_next( ptr, TAVL_DIR_RIGHT )) {
di = ptr->avl_data;
if ( ds->ds_dlm ) {
if ( overlay_entry_get_ov( op, &di->dy_name, NULL, NULL, 0, &e, on ) != LDAP_SUCCESS || e == NULL )
@ -1631,13 +1631,13 @@ dynlist_nestlink( Operation *op, dynlist_search_t *ds )
a = attr_find( e->e_attrs, ds->ds_dlm->dlm_member_ad );
if ( a ) {
for ( i=0; i < a->a_numvals; i++ ) {
dj = tavl_find( ds->ds_names, &a->a_nvals[i], dynlist_avl_cmp );
dj = ldap_tavl_find( ds->ds_names, &a->a_nvals[i], dynlist_avl_cmp );
if ( dj ) {
if ( ds->ds_want & WANT_MEMBEROF ) {
tavl_insert( &dj->dy_sups, di, dynlist_ptr_cmp, avl_dup_error );
ldap_tavl_insert( &dj->dy_sups, di, dynlist_ptr_cmp, ldap_avl_dup_error );
}
if ( ds->ds_want & WANT_MEMBER ) {
tavl_insert( &di->dy_subs, dj, dynlist_ptr_cmp, avl_dup_error );
ldap_tavl_insert( &di->dy_subs, dj, dynlist_ptr_cmp, ldap_avl_dup_error );
}
}
}

View File

@ -31,7 +31,7 @@
#include "slap.h"
#include "lutil.h"
#include "ldap_rq.h"
#include "avl.h"
#include "ldap_avl.h"
#include "../back-monitor/back-monitor.h"
@ -1290,10 +1290,10 @@ find_filter( Operation *op, TAvlnode *root, Filter *inputf, Filter *first )
* walk the entire list.
*/
if ( first->f_choice == LDAP_FILTER_SUBSTRINGS ) {
ptr = tavl_end( root, 1 );
ptr = ldap_tavl_end( root, 1 );
dir = TAVL_DIR_LEFT;
} else {
ptr = tavl_find3( root, &cq, pcache_query_cmp, &ret );
ptr = ldap_tavl_find3( root, &cq, pcache_query_cmp, &ret );
dir = (first->f_choice == LDAP_FILTER_GE) ? TAVL_DIR_LEFT :
TAVL_DIR_RIGHT;
}
@ -1317,7 +1317,7 @@ find_filter( Operation *op, TAvlnode *root, Filter *inputf, Filter *first )
if ( eqpass == 0 ) {
if ( qc->first->f_choice != LDAP_FILTER_EQUALITY ) {
nextpass: eqpass = 1;
ptr = tavl_end( root, 1 );
ptr = ldap_tavl_end( root, 1 );
dir = TAVL_DIR_LEFT;
continue;
}
@ -1426,7 +1426,7 @@ nextpass: eqpass = 1;
if ( res )
return qc;
ptr = tavl_next( ptr, dir );
ptr = ldap_tavl_next( ptr, dir );
}
return NULL;
}
@ -1456,7 +1456,7 @@ query_containment(Operation *op, query_manager *qm,
ldap_pvt_thread_rdwr_rlock(&templa->t_rwlock);
for( ;; ) {
/* Find the base */
qbptr = avl_find( templa->qbase, &qbase, pcache_dn_cmp );
qbptr = ldap_avl_find( templa->qbase, &qbase, pcache_dn_cmp );
if ( qbptr ) {
tscope = query->scope;
/* Find a matching scope:
@ -1616,20 +1616,20 @@ add_query(
Debug( pcache_debug, "Lock AQ index = %p\n",
(void *) templ );
ldap_pvt_thread_rdwr_wlock(&templ->t_rwlock);
qbase = avl_find( templ->qbase, &qb, pcache_dn_cmp );
qbase = ldap_avl_find( templ->qbase, &qb, pcache_dn_cmp );
if ( !qbase ) {
qbase = ch_calloc( 1, sizeof(Qbase) + qb.base.bv_len + 1 );
qbase->base.bv_len = qb.base.bv_len;
qbase->base.bv_val = (char *)(qbase+1);
memcpy( qbase->base.bv_val, qb.base.bv_val, qb.base.bv_len );
qbase->base.bv_val[qbase->base.bv_len] = '\0';
avl_insert( &templ->qbase, qbase, pcache_dn_cmp, avl_dup_error );
ldap_avl_insert( &templ->qbase, qbase, pcache_dn_cmp, ldap_avl_dup_error );
}
new_cached_query->next = templ->query;
new_cached_query->prev = NULL;
new_cached_query->qbase = qbase;
rc = tavl_insert( &qbase->scopes[query->scope], new_cached_query,
pcache_query_cmp, avl_dup_error );
rc = ldap_tavl_insert( &qbase->scopes[query->scope], new_cached_query,
pcache_query_cmp, ldap_avl_dup_error );
if ( rc == 0 ) {
qbase->queries++;
if (templ->query == NULL)
@ -1680,10 +1680,10 @@ remove_from_template (CachedQuery* qc, QueryTemplate* template)
qc->next->prev = qc->prev;
qc->prev->next = qc->next;
}
tavl_delete( &qc->qbase->scopes[qc->scope], qc, pcache_query_cmp );
ldap_tavl_delete( &qc->qbase->scopes[qc->scope], qc, pcache_query_cmp );
qc->qbase->queries--;
if ( qc->qbase->queries == 0 ) {
avl_delete( &template->qbase, qc->qbase, pcache_dn_cmp );
ldap_avl_delete( &template->qbase, qc->qbase, pcache_dn_cmp );
ch_free( qc->qbase );
qc->qbase = NULL;
}
@ -4778,7 +4778,7 @@ pcache_free_qbase( void *v )
int i;
for (i=0; i<3; i++)
tavl_free( qb->scopes[i], NULL );
ldap_tavl_free( qb->scopes[i], NULL );
ch_free( qb );
}
@ -4910,7 +4910,7 @@ pcache_db_destroy(
qn = qc->next;
free_query( qc );
}
avl_free( tm->qbase, pcache_free_qbase );
ldap_avl_free( tm->qbase, pcache_free_qbase );
free( tm->querystr.bv_val );
free( tm->bindfattrs );
free( tm->bindftemp.bv_val );

View File

@ -2229,10 +2229,10 @@ rwm_cf_gen( ConfigArgs *c )
/* in case of failure, restore
* the existing mapping */
if ( rc ) {
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_at.map, rwm_mapping_free );
rwmap->rwm_oc = rwm_oc;
rwmap->rwm_at = rwm_at;
break;
@ -2242,10 +2242,10 @@ rwm_cf_gen( ConfigArgs *c )
/* in case of success, destroy the old mapping
* and eliminate the deleted one */
if ( rc == 0 ) {
avl_free( rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwm_oc.map, rwm_mapping_free );
avl_free( rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwm_at.map, rwm_mapping_free );
ber_memfree( rwmap->rwm_bva_map[ c->valx ].bv_val );
for ( cnt = c->valx; !BER_BVISNULL( &rwmap->rwm_bva_map[ cnt ] ); cnt++ ) {
@ -2254,10 +2254,10 @@ rwm_cf_gen( ConfigArgs *c )
}
} else {
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_at.map, rwm_mapping_free );
rwmap->rwm_oc.remap = NULL;
rwmap->rwm_oc.map = NULL;
@ -2535,10 +2535,10 @@ rwm_cf_gen( ConfigArgs *c )
rwmap->rwm_bva_map = tmp;
BER_BVZERO( &rwmap->rwm_bva_map[ cnt + 1 ] );
avl_free( rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwm_oc.map, rwm_mapping_free );
avl_free( rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwm_at.map, rwm_mapping_free );
for ( ; cnt-- > c->valx; ) {
rwmap->rwm_bva_map[ cnt + 1 ] = rwmap->rwm_bva_map[ cnt ];
@ -2547,10 +2547,10 @@ rwm_cf_gen( ConfigArgs *c )
} else {
rwmmap_fail:;
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_at.map, rwm_mapping_free );
rwmap->rwm_oc = rwm_oc;
rwmap->rwm_at = rwm_at;
}
@ -2644,10 +2644,10 @@ rwm_db_destroy(
ber_bvarray_free( rwmap->rwm_bva_rewrite );
}
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
ldap_avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
ldap_avl_free( rwmap->rwm_at.map, rwm_mapping_free );
ber_bvarray_free( rwmap->rwm_bva_map );
ch_free( rwmap );

View File

@ -216,8 +216,8 @@ rwm_map_config(
mapping[1].m_src_ad = mapping[0].m_dst_ad;
}
if ( ( src[0] != '\0' && avl_find( map->map, (caddr_t)mapping, rwm_mapping_cmp ) != NULL)
|| avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
if ( ( src[0] != '\0' && ldap_avl_find( map->map, (caddr_t)mapping, rwm_mapping_cmp ) != NULL)
|| ldap_avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
{
Debug( LDAP_DEBUG_ANY,
"%s: line %d: duplicate mapping found.\n",
@ -227,10 +227,10 @@ rwm_map_config(
}
if ( src[0] != '\0' ) {
avl_insert( &map->map, (caddr_t)&mapping[0],
ldap_avl_insert( &map->map, (caddr_t)&mapping[0],
rwm_mapping_cmp, rwm_mapping_dup );
}
avl_insert( &map->remap, (caddr_t)&mapping[1],
ldap_avl_insert( &map->remap, (caddr_t)&mapping[1],
rwm_mapping_cmp, rwm_mapping_dup );
success_return:;

View File

@ -99,9 +99,9 @@ rwm_map_init( struct ldapmap *lm, struct ldapmapping **m )
mapping[1].m_src_ad = mapping[0].m_src_ad;
mapping[1].m_dst_ad = mapping[1].m_src_ad;
avl_insert( &lm->map, (caddr_t)&mapping[0],
ldap_avl_insert( &lm->map, (caddr_t)&mapping[0],
rwm_mapping_cmp, rwm_mapping_dup );
avl_insert( &lm->remap, (caddr_t)&mapping[1],
ldap_avl_insert( &lm->remap, (caddr_t)&mapping[1],
rwm_mapping_cmp, rwm_mapping_dup );
*m = mapping;
@ -138,7 +138,7 @@ rwm_mapping( struct ldapmap *map, struct berval *s, struct ldapmapping **m, int
}
fmapping.m_src = *s;
*m = (struct ldapmapping *)avl_find( tree, (caddr_t)&fmapping,
*m = (struct ldapmapping *)ldap_avl_find( tree, (caddr_t)&fmapping,
rwm_mapping_cmp );
if ( *m == NULL ) {

View File

@ -61,7 +61,7 @@ seqmod_op_cleanup( Operation *op, SlapReply *rs )
mtdummy.mt_op = op;
/* This op is done, remove it */
ldap_pvt_thread_mutex_lock( &sm->sm_mutex );
av = avl_find2( sm->sm_mods, &mtdummy, sm_avl_cmp );
av = ldap_avl_find2( sm->sm_mods, &mtdummy, sm_avl_cmp );
assert(av != NULL);
mt = av->avl_data;
@ -71,7 +71,7 @@ seqmod_op_cleanup( Operation *op, SlapReply *rs )
av->avl_data = mt->mt_next;
mt->mt_next->mt_tail = mt->mt_tail;
} else {
avl_delete( &sm->sm_mods, mt, sm_avl_cmp );
ldap_avl_delete( &sm->sm_mods, mt, sm_avl_cmp );
}
ldap_pvt_thread_mutex_unlock( &sm->sm_mutex );
op->o_callback = sc->sc_next;
@ -100,7 +100,7 @@ seqmod_op_mod( Operation *op, SlapReply *rs )
* near-simultaneous mods of the same entry
*/
ldap_pvt_thread_mutex_lock( &sm->sm_mutex );
av = avl_find2( sm->sm_mods, mt, sm_avl_cmp );
av = ldap_avl_find2( sm->sm_mods, mt, sm_avl_cmp );
if ( av ) {
modtarget *mtp = av->avl_data;
mtp->mt_tail->mt_next = mt;
@ -116,7 +116,7 @@ seqmod_op_mod( Operation *op, SlapReply *rs )
}
} else {
/* Record that we're modifying this now */
avl_insert( &sm->sm_mods, mt, sm_avl_cmp, avl_dup_error );
ldap_avl_insert( &sm->sm_mods, mt, sm_avl_cmp, ldap_avl_dup_error );
}
ldap_pvt_thread_mutex_unlock( &sm->sm_mutex );

View File

@ -29,7 +29,7 @@
#include <ac/string.h>
#include <ac/ctype.h>
#include <avl.h>
#include <ldap_avl.h>
#include "slap.h"
#include "lutil.h"
@ -411,14 +411,14 @@ static void free_sort_op( Connection *conn, sort_op *so )
TAvlnode *cur_node, *next_node;
cur_node = so->so_tree;
while ( cur_node ) {
next_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
next_node = ldap_tavl_next( cur_node, TAVL_DIR_RIGHT );
ch_free( cur_node->avl_data );
ber_memfree( cur_node );
cur_node = next_node;
}
} else {
tavl_free( so->so_tree, ch_free );
ldap_tavl_free( so->so_tree, ch_free );
}
so->so_tree = NULL;
}
@ -463,11 +463,11 @@ static void send_list(
if ( BER_BVISNULL( &vc->vc_value )) {
if ( vc->vc_offset == vc->vc_count ) {
/* wants the last entry in the list */
cur_node = tavl_end(so->so_tree, TAVL_DIR_RIGHT);
cur_node = ldap_tavl_end(so->so_tree, TAVL_DIR_RIGHT);
so->so_vlv_target = so->so_nentries;
} else if ( vc->vc_offset == 1 ) {
/* wants the first entry in the list */
cur_node = tavl_end(so->so_tree, TAVL_DIR_LEFT);
cur_node = ldap_tavl_end(so->so_tree, TAVL_DIR_LEFT);
so->so_vlv_target = 1;
} else {
int target;
@ -491,15 +491,15 @@ range_err:
so->so_vlv_target = target;
/* Start at left and go right, or start at right and go left? */
if ( target < so->so_nentries / 2 ) {
cur_node = tavl_end(so->so_tree, TAVL_DIR_LEFT);
cur_node = ldap_tavl_end(so->so_tree, TAVL_DIR_LEFT);
dir = TAVL_DIR_RIGHT;
} else {
cur_node = tavl_end(so->so_tree, TAVL_DIR_RIGHT);
cur_node = ldap_tavl_end(so->so_tree, TAVL_DIR_RIGHT);
dir = TAVL_DIR_LEFT;
target = so->so_nentries - target + 1;
}
for ( i=1; i<target; i++ )
cur_node = tavl_next( cur_node, dir );
cur_node = ldap_tavl_next( cur_node, dir );
}
} else {
/* we're looking for a specific value */
@ -532,11 +532,11 @@ range_err:
for (i=1; i<sc->sc_nkeys; i++) {
BER_BVZERO( &sn->sn_vals[i] );
}
cur_node = tavl_find3( so->so_tree, sn, node_cmp, &j );
cur_node = ldap_tavl_find3( so->so_tree, sn, node_cmp, &j );
/* didn't find >= match */
if ( j > 0 ) {
if ( cur_node )
cur_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
cur_node = ldap_tavl_next( cur_node, TAVL_DIR_RIGHT );
}
op->o_tmpfree( sn, op->o_tmpmemctx );
@ -547,14 +547,14 @@ range_err:
/* start from the left or the right side? */
mr->smr_match( &i, 0, mr->smr_syntax, mr, &bv, &sn->sn_vals[0] );
if ( i > 0 ) {
tmp_node = tavl_end(so->so_tree, TAVL_DIR_RIGHT);
tmp_node = ldap_tavl_end(so->so_tree, TAVL_DIR_RIGHT);
dir = TAVL_DIR_LEFT;
} else {
tmp_node = tavl_end(so->so_tree, TAVL_DIR_LEFT);
tmp_node = ldap_tavl_end(so->so_tree, TAVL_DIR_LEFT);
dir = TAVL_DIR_RIGHT;
}
for (i=0; tmp_node != cur_node;
tmp_node = tavl_next( tmp_node, dir ), i++);
tmp_node = ldap_tavl_next( tmp_node, dir ), i++);
so->so_vlv_target = (dir == TAVL_DIR_RIGHT) ? i+1 : so->so_nentries - i;
}
if ( bv.bv_val != vc->vc_value.bv_val )
@ -562,12 +562,12 @@ range_err:
}
if ( !cur_node ) {
i = 1;
cur_node = tavl_end(so->so_tree, TAVL_DIR_RIGHT);
cur_node = ldap_tavl_end(so->so_tree, TAVL_DIR_RIGHT);
} else {
i = 0;
}
for ( ; i<vc->vc_before; i++ ) {
tmp_node = tavl_next( cur_node, TAVL_DIR_LEFT );
tmp_node = ldap_tavl_next( cur_node, TAVL_DIR_LEFT );
if ( !tmp_node ) break;
cur_node = tmp_node;
}
@ -589,7 +589,7 @@ range_err:
if ( rs->sr_err == LDAP_UNAVAILABLE )
break;
}
cur_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
cur_node = ldap_tavl_next( cur_node, TAVL_DIR_RIGHT );
if ( !cur_node ) break;
}
so->so_vlv_rc = LDAP_SUCCESS;
@ -612,7 +612,7 @@ static void send_page( Operation *op, SlapReply *rs, sort_op *so )
if ( slapd_shutdown ) break;
next_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
next_node = ldap_tavl_next( cur_node, TAVL_DIR_RIGHT );
op->o_bd = select_backend( &sn->sn_dn, 0 );
e = NULL;
@ -664,7 +664,7 @@ static void send_entry(
send_list( op, rs, so );
} else {
/* Get the first node to send */
TAvlnode *start_node = tavl_end(so->so_tree, TAVL_DIR_LEFT);
TAvlnode *start_node = ldap_tavl_end(so->so_tree, TAVL_DIR_LEFT);
so->so_tree = start_node;
if ( so->so_paged <= SLAP_CONTROL_IGNORED ) {
@ -777,7 +777,7 @@ static int sssvlv_op_response(
sn->sn_session = find_session_by_so( so->so_info->svi_max_percon, op->o_conn->c_conn_idx, so );
/* Insert into the AVL tree */
tavl_insert(&(so->so_tree), sn, node_insert, avl_dup_error);
ldap_tavl_insert(&(so->so_tree), sn, node_insert, ldap_avl_dup_error);
so->so_nentries++;

View File

@ -1532,7 +1532,7 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs )
} else {
ldap_pvt_thread_mutex_unlock( &mt->mt_mutex );
ldap_pvt_thread_mutex_lock( &si->si_mods_mutex );
avl_delete( &si->si_mods, mt, sp_avl_cmp );
ldap_avl_delete( &si->si_mods, mt, sp_avl_cmp );
ldap_pvt_thread_mutex_unlock( &si->si_mods_mutex );
ldap_pvt_thread_mutex_destroy( &mt->mt_mutex );
ch_free( mt->mt_dn.bv_val );
@ -1649,7 +1649,7 @@ syncprov_add_slog( Operation *op )
ldap_pvt_thread_rdwr_wlock( &sl->sl_mutex );
/* can only do this if no one else is reading the log at the moment */
if ( !sl->sl_playing ) {
tavl_free( sl->sl_entries, (AVL_FREE)ch_free );
ldap_tavl_free( sl->sl_entries, (AVL_FREE)ch_free );
sl->sl_num = 0;
sl->sl_entries = NULL;
}
@ -1693,7 +1693,7 @@ syncprov_add_slog( Operation *op )
BER_BVZERO( &sl->sl_mincsn[1] );
}
}
rc = tavl_insert( &sl->sl_entries, se, syncprov_sessionlog_cmp, avl_dup_error );
rc = ldap_tavl_insert( &sl->sl_entries, se, syncprov_sessionlog_cmp, ldap_avl_dup_error );
if ( rc ) {
Debug( LDAP_DEBUG_SYNC, "%s syncprov_add_slog: "
"duplicate sessionlog entry ignored: csn=%s, uuid=%s\n",
@ -1703,10 +1703,10 @@ syncprov_add_slog( Operation *op )
}
sl->sl_num++;
if ( !sl->sl_playing && sl->sl_num > sl->sl_size ) {
TAvlnode *edge = tavl_end( sl->sl_entries, TAVL_DIR_LEFT );
TAvlnode *edge = ldap_tavl_end( sl->sl_entries, TAVL_DIR_LEFT );
while ( sl->sl_num > sl->sl_size ) {
int i;
TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
TAvlnode *next = ldap_tavl_next( edge, TAVL_DIR_RIGHT );
se = edge->avl_data;
Debug( LDAP_DEBUG_SYNC, "%s syncprov_add_slog: "
"expiring csn=%s from sessionlog (sessionlog size=%d)\n",
@ -1726,7 +1726,7 @@ syncprov_add_slog( Operation *op )
op->o_log_prefix, se->se_sid, sl->sl_mincsn[i].bv_val, se->se_csn.bv_val );
ber_bvreplace( &sl->sl_mincsn[i], &se->se_csn );
}
tavl_delete( &sl->sl_entries, se, syncprov_sessionlog_cmp );
ldap_tavl_delete( &sl->sl_entries, se, syncprov_sessionlog_cmp );
ch_free( se );
edge = next;
sl->sl_num--;
@ -1904,7 +1904,7 @@ syncprov_accesslog_uuid_cb( Operation *op, SlapReply *rs )
}
uuid[0] = a->a_nvals[0];
bv = avl_find( uuid_progress->uuids, uuid, sp_uuid_cmp );
bv = ldap_avl_find( uuid_progress->uuids, uuid, sp_uuid_cmp );
if ( bv ) {
/* Already checked or sent, no change */
Debug( LDAP_DEBUG_SYNC, "%s syncprov_accesslog_uuid_cb: "
@ -1928,7 +1928,7 @@ syncprov_accesslog_uuid_cb( Operation *op, SlapReply *rs )
bv->bv_len = a->a_nvals[0].bv_len;
AC_MEMCPY( bv->bv_val, a->a_nvals[0].bv_val, a->a_nvals[0].bv_len );
rc = avl_insert( &uuid_progress->uuids, bv, sp_uuid_cmp, avl_dup_error );
rc = ldap_avl_insert( &uuid_progress->uuids, bv, sp_uuid_cmp, ldap_avl_dup_error );
assert( rc == LDAP_SUCCESS );
if ( is_delete ) {
@ -1945,7 +1945,7 @@ syncprov_accesslog_uuid_cb( Operation *op, SlapReply *rs )
int ndel;
assert( uuid_progress->ndel == uuid_progress->list_len );
ndel = avl_free( uuid_progress->uuids, NULL );
ndel = ldap_avl_free( uuid_progress->uuids, NULL );
assert( ndel == uuid_progress->ndel );
uuid_progress->ndel = 0;
}
@ -2026,13 +2026,13 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
{
slog_entry te = {0};
te.se_csn = *mincsn;
entry = tavl_find3( sl->sl_entries, &te, syncprov_sessionlog_cmp, &ndel );
entry = ldap_tavl_find3( sl->sl_entries, &te, syncprov_sessionlog_cmp, &ndel );
}
if ( ndel > 0 && entry )
entry = tavl_next( entry, TAVL_DIR_LEFT );
entry = ldap_tavl_next( entry, TAVL_DIR_LEFT );
/* if none, just start at beginning */
if ( !entry )
entry = tavl_end( sl->sl_entries, TAVL_DIR_LEFT );
entry = ldap_tavl_end( sl->sl_entries, TAVL_DIR_LEFT );
do {
char uuidstr[40] = {};
@ -2096,7 +2096,7 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
uuidstr, csns[j].bv_val );
}
ldap_pvt_thread_rdwr_rlock( &sl->sl_mutex );
} while ( (entry = tavl_next( entry, TAVL_DIR_RIGHT )) != NULL );
} while ( (entry = ldap_tavl_next( entry, TAVL_DIR_RIGHT )) != NULL );
ldap_pvt_thread_rdwr_runlock( &sl->sl_mutex );
ldap_pvt_thread_rdwr_wlock( &sl->sl_mutex );
sl->sl_playing--;
@ -2649,7 +2649,7 @@ syncprov_op_mod( Operation *op, SlapReply *rs )
mtdummy.mt_dn = op->o_req_ndn;
retry:
ldap_pvt_thread_mutex_lock( &si->si_mods_mutex );
mt = avl_find( si->si_mods, &mtdummy, sp_avl_cmp );
mt = ldap_avl_find( si->si_mods, &mtdummy, sp_avl_cmp );
if ( mt ) {
ldap_pvt_thread_mutex_lock( &mt->mt_mutex );
if ( mt->mt_mods == NULL ) {
@ -2723,7 +2723,7 @@ retry:
mt->mt_tail = mi;
ber_dupbv( &mt->mt_dn, &mi->mi_op->o_req_ndn );
ldap_pvt_thread_mutex_init( &mt->mt_mutex );
avl_insert( &si->si_mods, mt, sp_avl_cmp, avl_dup_error );
ldap_avl_insert( &si->si_mods, mt, sp_avl_cmp, ldap_avl_dup_error );
ldap_pvt_thread_mutex_unlock( &si->si_mods_mutex );
}
opc->smt = mt;
@ -4022,7 +4022,7 @@ syncprov_db_destroy(
if ( si->si_logs ) {
sessionlog *sl = si->si_logs;
tavl_free( sl->sl_entries, (AVL_FREE)ch_free );
ldap_tavl_free( sl->sl_entries, (AVL_FREE)ch_free );
if ( sl->sl_mincsn )
ber_bvarray_free( sl->sl_mincsn );
if ( sl->sl_sids )

View File

@ -819,7 +819,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
le = rs->sr_entry;
/* If entry is already on list, use it */
if ( tc->step & USE_LIST ) {
re = tavl_delete( &tc->list, le, entry_dn_cmp );
re = ldap_tavl_delete( &tc->list, le, entry_dn_cmp );
if ( re ) {
rs_flush_entry( op, rs, on );
rc = test_filter( op, re, tc->orig );
@ -910,7 +910,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
}
/* If both filters, save entry for later */
if ( tc->step == (USE_LIST|RMT_SIDE) ) {
tavl_insert( &tc->list, re, entry_dn_cmp, avl_dup_error );
ldap_tavl_insert( &tc->list, re, entry_dn_cmp, ldap_avl_dup_error );
rs->sr_entry = NULL;
rc = 0;
} else {
@ -1180,7 +1180,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
if ( tc.list ) {
TAvlnode *av;
av = tavl_end( tc.list, TAVL_DIR_LEFT );
av = ldap_tavl_end( tc.list, TAVL_DIR_LEFT );
while ( av ) {
rs->sr_entry = av->avl_data;
if ( rc == LDAP_SUCCESS && LDAP_COMPARE_TRUE ==
@ -1191,9 +1191,9 @@ static int translucent_search(Operation *op, SlapReply *rs) {
} else {
entry_free( rs->sr_entry );
}
av = tavl_next( av, TAVL_DIR_RIGHT );
av = ldap_tavl_next( av, TAVL_DIR_RIGHT );
}
tavl_free( tc.list, NULL );
ldap_tavl_free( tc.list, NULL );
rs->sr_flags = 0;
rs->sr_entry = NULL;
}

View File

@ -40,7 +40,7 @@
#include <ac/time.h>
#include <ac/param.h>
#include "avl.h"
#include "ldap_avl.h"
#ifndef ldap_debug
#define ldap_debug slap_debug

View File

@ -3812,8 +3812,8 @@ presentlist_insert(
memcpy(&s, syncUUID->bv_val, 2);
memcpy(val, syncUUID->bv_val+2, UUIDLEN-2);
if ( avl_insert( &av[s], val,
syncuuid_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &av[s], val,
syncuuid_cmp, ldap_avl_dup_error ) )
{
ch_free( val );
return 0;
@ -3823,8 +3823,8 @@ presentlist_insert(
AC_MEMCPY( val, syncUUID->bv_val, UUIDLEN );
if ( avl_insert( &si->si_presentlist, val,
syncuuid_cmp, avl_dup_error ) )
if ( ldap_avl_insert( &si->si_presentlist, val,
syncuuid_cmp, ldap_avl_dup_error ) )
{
ch_free( val );
return 0;
@ -3847,9 +3847,9 @@ presentlist_find(
return NULL;
memcpy(&s, val->bv_val, 2);
return avl_find( a2[s], val->bv_val+2, syncuuid_cmp );
return ldap_avl_find( a2[s], val->bv_val+2, syncuuid_cmp );
#else
return avl_find( av, val->bv_val, syncuuid_cmp );
return ldap_avl_find( av, val->bv_val, syncuuid_cmp );
#endif
}
@ -3863,13 +3863,13 @@ presentlist_free( Avlnode *av )
if ( av ) {
for (i=0; i<65536; i++) {
if (a2[i])
count += avl_free( a2[i], ch_free );
count += ldap_avl_free( a2[i], ch_free );
}
ch_free( av );
}
return count;
#else
return avl_free( av, ch_free );
return ldap_avl_free( av, ch_free );
#endif
}
@ -3883,9 +3883,9 @@ presentlist_delete(
unsigned short s;
memcpy(&s, val->bv_val, 2);
avl_delete( &a2[s], val->bv_val+2, syncuuid_cmp );
ldap_avl_delete( &a2[s], val->bv_val+2, syncuuid_cmp );
#else
avl_delete( av, val->bv_val, syncuuid_cmp );
ldap_avl_delete( av, val->bv_val, syncuuid_cmp );
#endif
}

View File

@ -60,7 +60,7 @@ syn_find( const char *synname )
{
struct sindexrec *sir = NULL;
if ( (sir = avl_find( syn_index, synname, syn_index_name_cmp )) != NULL ) {
if ( (sir = ldap_avl_find( syn_index, synname, syn_index_name_cmp )) != NULL ) {
return( sir->sir_syn );
}
return( NULL );
@ -113,7 +113,7 @@ syn_destroy( void )
{
Syntax *s;
avl_free( syn_index, ldap_memfree );
ldap_avl_free( syn_index, ldap_memfree );
while( !LDAP_STAILQ_EMPTY( &syn_list ) ) {
s = LDAP_STAILQ_FIRST( &syn_list );
LDAP_STAILQ_REMOVE_HEAD( &syn_list, ssyn_next );
@ -143,8 +143,8 @@ syn_insert(
}
sir->sir_name = ssyn->ssyn_oid;
sir->sir_syn = ssyn;
if ( avl_insert( &syn_index, (caddr_t) sir,
syn_index_cmp, avl_dup_error ) ) {
if ( ldap_avl_insert( &syn_index, (caddr_t) sir,
syn_index_cmp, ldap_avl_dup_error ) ) {
*err = ssyn->ssyn_oid;
ldap_memfree(sir);
return SLAP_SCHERR_SYN_DUP;

View File

@ -87,7 +87,7 @@ slap_zn_mem_destroy(
ch_free(zh->zh_seqno);
ch_free(zh->zh_znlock);
avl_free(zh->zh_zonetree, slap_zo_release);
ldap_avl_free(zh->zh_zonetree, slap_zo_release);
zo = LDAP_LIST_FIRST(&zh->zh_zopool);
while (zo) {
@ -217,7 +217,7 @@ slap_zn_mem_create(
zo->zo_ptr = zh->zh_zones[i];
zo->zo_siz = zh->zh_zonesize;
zo->zo_idx = i;
avl_insert(&zh->zh_zonetree, zo, slap_zone_cmp, avl_dup_error);
ldap_avl_insert(&zh->zh_zonetree, zo, slap_zone_cmp, ldap_avl_dup_error);
ldap_pvt_thread_rdwr_init(&zh->zh_znlock[i]);
}
@ -371,7 +371,7 @@ retry:
zo->zo_ptr = zh->zh_zones[i];
zo->zo_siz = zh->zh_zonesize;
zo->zo_idx = i;
avl_insert(&zh->zh_zonetree, zo, slap_zone_cmp, avl_dup_error);
ldap_avl_insert(&zh->zh_zonetree, zo, slap_zone_cmp, ldap_avl_dup_error);
ldap_pvt_thread_rdwr_init(&zh->zh_znlock[i]);
}
zh->zh_numzones += zh->zh_deltazones;
@ -416,7 +416,7 @@ slap_zn_realloc(void *ptr, ber_len_t size, void *ctx)
if (zh) {
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
}
@ -472,7 +472,7 @@ slap_zn_free(void *ptr, void *ctx)
if (zh) {
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
}
@ -694,7 +694,7 @@ slap_zn_invalidate(
zoi.zo_idx = -1;
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
if (zoo) {
idx = zoo->zo_idx;
@ -752,7 +752,7 @@ slap_zn_validate(
zoi.zo_ptr = ptr;
zoi.zo_idx = -1;
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
if (zoo) {
idx = zoo->zo_idx;
@ -810,7 +810,7 @@ int slap_zn_rlock(
zoi.zo_idx = -1;
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
if (zoo) {
@ -834,7 +834,7 @@ int slap_zn_runlock(
zoi.zo_idx = -1;
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
if (zoo) {
@ -858,7 +858,7 @@ int slap_zn_wlock(
zoi.zo_idx = -1;
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
if (zoo) {
@ -882,7 +882,7 @@ int slap_zn_wunlock(
zoi.zo_idx = -1;
ldap_pvt_thread_mutex_lock( &zh->zh_mutex );
zoo = avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
zoo = ldap_avl_find(zh->zh_zonetree, &zoi, slap_zone_cmp);
ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
if (zoo) {