X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_avltree.c;h=a9b3862c0ecf4ba5533d0676c3fcdc3d9363a141;hb=1122c8fd30065b5990a5b798b7bfd8891736def9;hp=ecaf3c915967b2daee20489b9d8aa02aa41e6de6;hpb=3d2e974839fb6590b84e58e000fa92ed6282f4c4;p=collectd.git diff --git a/src/utils_avltree.c b/src/utils_avltree.c index ecaf3c91..a9b3862c 100644 --- a/src/utils_avltree.c +++ b/src/utils_avltree.c @@ -241,7 +241,7 @@ static void rebalance (c_avl_tree_t *t, c_avl_node_t *n) { assert (n->right != NULL); b_bottom = BALANCE (n->right); - assert ((b_bottom >= -1) || (b_bottom <= 1)); + assert ((b_bottom >= -1) && (b_bottom <= 1)); if (b_bottom == 1) n = rotate_right_left (t, n); else @@ -251,7 +251,7 @@ static void rebalance (c_avl_tree_t *t, c_avl_node_t *n) { assert (n->left != NULL); b_bottom = BALANCE (n->left); - assert ((b_bottom >= -1) || (b_bottom <= 1)); + assert ((b_bottom >= -1) && (b_bottom <= 1)); if (b_bottom == -1) n = rotate_left_right (t, n); else @@ -648,6 +648,7 @@ int c_avl_pick (c_avl_tree_t *t, void **key, void **value) *value = n->value; free_node (n); + --t->size; rebalance (t, p); return (0);