From 3d2e974839fb6590b84e58e000fa92ed6282f4c4 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 17 Jun 2015 22:08:19 +0200 Subject: [PATCH] src/utils_avltree.c: Add assertions to rotate_{left,right}(). clang's static code analysis thought that x->right / x->left could be NULL, reporting false positives. Let's see if this fixes it. --- src/utils_avltree.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils_avltree.c b/src/utils_avltree.c index 6a25fb57..ecaf3c91 100644 --- a/src/utils_avltree.c +++ b/src/utils_avltree.c @@ -142,6 +142,9 @@ static c_avl_node_t *rotate_right (c_avl_tree_t *t, c_avl_node_t *x) c_avl_node_t *y; c_avl_node_t *b; + assert (x != NULL); + assert (x->left != NULL); + p = x->parent; y = x->left; b = y->right; @@ -166,7 +169,7 @@ static c_avl_node_t *rotate_right (c_avl_tree_t *t, c_avl_node_t *x) y->height = calc_height (y); return (y); -} /* void rotate_left */ +} /* void rotate_right */ /* * (x) (y) @@ -183,6 +186,9 @@ static c_avl_node_t *rotate_left (c_avl_tree_t *t, c_avl_node_t *x) c_avl_node_t *y; c_avl_node_t *b; + assert (x != NULL); + assert (x->right != NULL); + p = x->parent; y = x->right; b = y->left; -- 2.30.2