diff options
| author | Thomas Schmucker <ts@its1.de> | 2021-12-29 10:49:19 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2021-12-29 10:49:19 +0100 |
| commit | 5e696c74c9649b0e54133d46a3ae92e5ce0632fb (patch) | |
| tree | ef9d4e6bcf9797b74e13ddbf943f424ac1d49664 /avl.c | |
| parent | a9fecebe13be05c15a5adf5a6fcefacb73d0d035 (diff) | |
| parent | 6ced2a50056acbf7caec404a1edfa3b07fa1ac5d (diff) | |
| download | data-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -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) | |||
| 215 | static void | 215 | static void |
| 216 | del(struct tree_node **q, struct tree_node **r, bool *h) | 216 | del(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); |
