Browse Source

Fixed mistakes from previous commit

Cameron Weinfurt 1 year ago
parent
commit
ebc4bf428b
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      tree_alloc.c

+ 2
- 2
tree_alloc.c View File

@@ -131,8 +131,8 @@ void repair_tree_after_insert(TreeAlloc *ta) {
131 131
 		if (uncle != NULL && uncle->color == COLOR_RED) {
132 132
 			parent->color = COLOR_BLACK;
133 133
 			uncle->color = COLOR_BLACK;
134
-			grandparent = COLOR_RED;
135
-			repair_tree(grandparent);
134
+			grandparent->color = COLOR_RED;
135
+			repair_tree_after_insert(grandparent);
136 136
 		} else {
137 137
 				if (ta == parent->left && parent == grandparent->left) {
138 138
 						rotate_left(parent);

Loading…
Cancel
Save