]> wimlib.net Git - wimlib/commitdiff
avl_tree.c: Remove avl_set_balance_factor()
authorEric Biggers <ebiggers3@gmail.com>
Sun, 15 Jun 2014 05:15:24 +0000 (00:15 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 16 Jun 2014 01:30:38 +0000 (20:30 -0500)
src/avl_tree.c

index 293db45d408903580fb001747082af28ac6b97bc..86eb38823477e72b9f13a37c17153eb281e54cc8 100644 (file)
@@ -127,15 +127,6 @@ avl_get_balance_factor(const struct avl_tree_node *node)
        return (int)(node->parent_balance & 3) - 1;
 }
 
        return (int)(node->parent_balance & 3) - 1;
 }
 
-/* Sets the balance factor of the specified AVL tree node.  This must be
- * -1, 0, or 1.  */
-static AVL_INLINE void
-avl_set_balance_factor(struct avl_tree_node *node, int balance_factor)
-{
-       node->parent_balance =
-               (node->parent_balance & ~3) | (balance_factor + 1);
-}
-
 /* Adds @amount to the balance factor of the specified AVL tree node.
  * The caller must ensure this still results in a valid balance factor
  * (-1, 0, or 1).  */
 /* Adds @amount to the balance factor of the specified AVL tree node.
  * The caller must ensure this still results in a valid balance factor
  * (-1, 0, or 1).  */
@@ -380,12 +371,10 @@ avl_handle_subtree_growth(struct avl_tree_node ** const root_ptr,
                 */
                avl_rotate(root_ptr, parent, -sign);
 
                 */
                avl_rotate(root_ptr, parent, -sign);
 
-               /* Equivalent to:
-                *    avl_set_balance_factor(parent, 0);  */
+               /* Equivalent to setting @parent's balance factor to 0.  */
                avl_adjust_balance_factor(parent, -sign); /* A */
 
                avl_adjust_balance_factor(parent, -sign); /* A */
 
-               /* Equivalent to:
-                *    avl_set_balance_factor(node, 0);  */
+               /* Equivalent to setting @node's balance factor to 0.  */
                avl_adjust_balance_factor(node, -sign);   /* B */
        } else {
                /* @node (B below) is heavy in the direction opposite
                avl_adjust_balance_factor(node, -sign);   /* B */
        } else {
                /* @node (B below) is heavy in the direction opposite