]> wimlib.net Git - wimlib/commitdiff
avl_tree: Fix comments
authorEric Biggers <ebiggers3@gmail.com>
Sun, 30 Mar 2014 05:26:22 +0000 (00:26 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 30 Mar 2014 05:28:41 +0000 (00:28 -0500)
include/wimlib/avl_tree.h
src/avl_tree.c

index da5bbd069d83813bad07a67c2b4d3f7106a9a7a4..875c9f02a83da8f51acf594f47d02b14a4da3b15 100644 (file)
@@ -98,8 +98,7 @@ avl_tree_rebalance_after_insert(struct avl_tree_node **root_ptr,
  *     Comparison callback.  Must return < 0, 0, or > 0 if the first argument
  *     is less than, equal to, or greater than the second argument,
  *     respectively.  The first argument will be @cmp_ctx and the second
  *     Comparison callback.  Must return < 0, 0, or > 0 if the first argument
  *     is less than, equal to, or greater than the second argument,
  *     respectively.  The first argument will be @cmp_ctx and the second
- *     argument will be a pointer to the AVL tree node contained in the item
- *     inserted into the AVL tree.
+ *     argument will be a pointer to the AVL tree node of an item in the tree.
  *
  * Returns a pointer to the AVL tree node embedded in the resulting item, or
  * NULL if the item was not found.
  *
  * Returns a pointer to the AVL tree node embedded in the resulting item, or
  * NULL if the item was not found.
index ab269d0e72d0c98c93f2f50d83b0dd6b83f0f62c..eafbb80fcebb29e5078076a790d834cd4d566ecd 100644 (file)
@@ -293,7 +293,6 @@ avl_handle_subtree_growth(struct avl_tree_node * const node,
                 *      balance(A) = -2
                 *      balance(B) = +1
                 * Let x = height(C).  Then:
                 *      balance(A) = -2
                 *      balance(B) = +1
                 * Let x = height(C).  Then:
-                *      height(A)
                 *      height(B) = x + 2
                 *      height(E) = x + 1
                 *      height(D) = x
                 *      height(B) = x + 2
                 *      height(E) = x + 1
                 *      height(D) = x
@@ -455,11 +454,12 @@ avl_tree_swap_with_successor(struct avl_tree_node * const X)
        avl_set_balance_factor(X, Y_balance_factor);
 }
 
        avl_set_balance_factor(X, Y_balance_factor);
 }
 
-/* Removes the specified @node from the AVL tree whose root is pointed to by
- * @root_ptr.
+/* Removes the specified @node from the AVL tree.  @root_ptr must point to the
+ * pointer to the root node of the tree; *root_ptr may change if the tree is
+ * rebalanced.
  *
  *
- * This *only* unlinks the node and rebalances the tree; it does not free any
- * memory or anything.  */
+ * This *only* removes the node and rebalances the tree; it does not free
+ * memory, nor does it do the equivalent of avl_tree_node_set_unlinked().  */
 void
 avl_tree_remove(struct avl_tree_node **root_ptr, struct avl_tree_node *node)
 {
 void
 avl_tree_remove(struct avl_tree_node **root_ptr, struct avl_tree_node *node)
 {