]> git.sur5r.net Git - openldap/commitdiff
Tweak branches in avl_find
authorHoward Chu <hyc@openldap.org>
Mon, 26 Sep 2005 08:21:10 +0000 (08:21 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 26 Sep 2005 08:21:10 +0000 (08:21 +0000)
libraries/liblutil/avl.c

index fecb8d2faa80fd1e935cff932a390f94951731a6..e5a5153d08fc11ceee4b295075891c73f1b2b701 100644 (file)
@@ -528,10 +528,8 @@ avl_find2( Avlnode *root, const void *data, AVL_CMP 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;
+               cmp = cmp > 0;
+               root = root->avl_link[cmp];
        }
        return root;
 }
@@ -542,10 +540,8 @@ avl_find( Avlnode *root, const void* data, AVL_CMP 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;
+               cmp = cmp > 0;
+               root = root->avl_link[cmp];
        }
 
        return( root ? root->avl_data : 0 );