From: Howard Chu Date: Thu, 27 Sep 2001 01:08:22 +0000 (+0000) Subject: Change avl.c to use ber_memalloc and ber_memrealloc. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1050 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2a853f0ca5ba8ea04504bb3b7b68143311565ac0;p=openldap Change avl.c to use ber_memalloc and ber_memrealloc. Add -llber to Makefile so testavl will build. --- diff --git a/libraries/libavl/Makefile.in b/libraries/libavl/Makefile.in index 0ccaefee7c..1d3c61e347 100644 --- a/libraries/libavl/Makefile.in +++ b/libraries/libavl/Makefile.in @@ -14,7 +14,7 @@ LDAP_LIBDIR= ../../libraries LIBRARY = libavl.a PROGRAMS = testavl -XLIBS = -lavl +XLIBS = -lavl -llber testavl: $(LIBRARY) testavl.o $(LTLINK) -o $@ testavl.o $(LIBS) diff --git a/libraries/libavl/avl.c b/libraries/libavl/avl.c index ea780a9eff..827e7d3404 100644 --- a/libraries/libavl/avl.c +++ b/libraries/libavl/avl.c @@ -21,6 +21,11 @@ #include #include +#ifdef CSRIMALLOC +#define ber_memalloc malloc +#define ber_memrealloc realloc +#endif + #define AVL_INTERNAL #include "avl.h" @@ -64,7 +69,7 @@ ravl_insert( Avlnode *l, *r; if ( *iroot == 0 ) { - if ( (*iroot = (Avlnode *) malloc( sizeof( Avlnode ) )) + if ( (*iroot = (Avlnode *) ber_memalloc( sizeof( Avlnode ) )) == NULL ) { return( -1 ); } @@ -680,12 +685,12 @@ avl_buildlist( void* data, void* arg ) static int slots; if ( avl_list == (void* *) 0 ) { - avl_list = (void* *) malloc(AVL_GRABSIZE * sizeof(void*)); + avl_list = (void* *) ber_memalloc(AVL_GRABSIZE * sizeof(void*)); slots = AVL_GRABSIZE; avl_maxlist = 0; } else if ( avl_maxlist == slots ) { slots += AVL_GRABSIZE; - avl_list = (void* *) realloc( (char *) avl_list, + avl_list = (void* *) ber_memrealloc( (char *) avl_list, (unsigned) slots * sizeof(void*)); }