From: Eric Biggers Date: Sun, 30 Mar 2014 05:26:22 +0000 (-0500) Subject: avl_tree: Fix comments X-Git-Tag: v1.6.2~7 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=b85695a5f5f50bb0e06f945a2e83cf9dfed08ca7 avl_tree: Fix comments --- diff --git a/include/wimlib/avl_tree.h b/include/wimlib/avl_tree.h index da5bbd06..875c9f02 100644 --- a/include/wimlib/avl_tree.h +++ b/include/wimlib/avl_tree.h @@ -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 - * 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. diff --git a/src/avl_tree.c b/src/avl_tree.c index ab269d0e..eafbb80f 100644 --- a/src/avl_tree.c +++ b/src/avl_tree.c @@ -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: - * height(A) * 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); } -/* 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) {