instead of recycling thru avl_find/avl_delete/avl_insert
typedef struct avlnode Avlnode;
-#ifdef AVL_INTERNAL
struct avlnode {
void* avl_data;
signed int avl_bf;
struct avlnode *avl_right;
};
+#ifdef AVL_INTERNAL
+
#define NULLAVL ((Avlnode *) NULL)
/* balance factor values */
LDAP_AVL_F( void* )
avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
+LDAP_AVL_F( Avlnode* )
+avl_find2 LDAP_P((Avlnode *, const void*, AVL_CMP));
+
LDAP_AVL_F( void* )
avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
* < 0 if arg1 is less than arg2 and > 0 if arg1 is greater than arg2.
*/
-void*
-avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
+Avlnode *
+avl_find2( Avlnode *root, const void *data, AVL_CMP fcmp )
{
int cmp;
else
root = root->avl_right;
}
+ return root;
+}
+
+void*
+avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
+{
+ root = avl_find2( root, data, fcmp );
return( root ? root->avl_data : 0 );
}