aboutsummaryrefslogtreecommitdiff
path: root/avl.c
diff options
context:
space:
mode:
Diffstat (limited to 'avl.c')
-rw-r--r--avl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/avl.c b/avl.c
index 13a3d5f..0dfe6ca 100644
--- a/avl.c
+++ b/avl.c
@@ -34,7 +34,7 @@ insert_r(T x, struct tree_node *p, bool *h)
34 *h = true; 34 *h = true;
35 35
36 p = malloc(sizeof *p); 36 p = malloc(sizeof *p);
37 if ( p != NULL ) { 37 if ( p ) {
38 p->left = NULL; 38 p->left = NULL;
39 p->right = NULL; 39 p->right = NULL;
40 p->bal = 0; 40 p->bal = 0;
@@ -215,7 +215,7 @@ balanceR(struct tree_node *p, bool *h)
215static void 215static void
216del(struct tree_node **q, struct tree_node **r, bool *h) 216del(struct tree_node **q, struct tree_node **r, bool *h)
217{ 217{
218 if ( (*r)->right != NULL ) { 218 if ( (*r)->right ) {
219 del(q, &(*r)->right, h); 219 del(q, &(*r)->right, h);
220 if ( *h ) 220 if ( *h )
221 *r = balanceR(*r, h); 221 *r = balanceR(*r, h);