aboutsummaryrefslogtreecommitdiff
path: root/avl.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2021-12-29 10:49:19 +0100
committerThomas Schmucker <ts@its1.de>2021-12-29 10:49:19 +0100
commit5e696c74c9649b0e54133d46a3ae92e5ce0632fb (patch)
treeef9d4e6bcf9797b74e13ddbf943f424ac1d49664 /avl.c
parenta9fecebe13be05c15a5adf5a6fcefacb73d0d035 (diff)
parent6ced2a50056acbf7caec404a1edfa3b07fa1ac5d (diff)
downloaddata-structures-5e696c74c9649b0e54133d46a3ae92e5ce0632fb.tar.gz
data-structures-5e696c74c9649b0e54133d46a3ae92e5ce0632fb.tar.bz2
data-structures-5e696c74c9649b0e54133d46a3ae92e5ce0632fb.zip
Merge branch 'feat/remove-null-checks'
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);