]> git.sur5r.net Git - openldap/commitdiff
Restore avl_find code independent of avl_find2
authorHoward Chu <hyc@openldap.org>
Mon, 24 Jan 2005 03:39:56 +0000 (03:39 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 24 Jan 2005 03:39:56 +0000 (03:39 +0000)
libraries/liblutil/avl.c

index ad2918d5576f90daaf2522c0f11f01fa435c6057..279ff7f3eb9d183a3d8c8ff48ae051af25ef0724 100644 (file)
@@ -661,7 +661,14 @@ avl_find2( Avlnode *root, const void *data, AVL_CMP fcmp )
 void*
 avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
 {
-       root = avl_find2( root, data, fcmp );
+       int     cmp;
+
+       while ( root != 0 && (cmp = (*fcmp)( data, root->avl_data )) != 0 ) {
+               if ( cmp < 0 )
+                       root = root->avl_left;
+               else
+                       root = root->avl_right;
+       }
 
        return( root ? root->avl_data : 0 );
 }