899 } |
899 } |
900 return visitor.depth; |
900 return visitor.depth; |
901 } |
901 } |
902 |
902 |
903 void cxTreeRemove(CxTree *tree, void *node) { |
903 void cxTreeRemove(CxTree *tree, void *node) { |
|
904 if (node == tree->root) { |
|
905 tree->root = NULL; |
|
906 tree->size = 0; |
|
907 return; |
|
908 } |
904 size_t subtree_size = cxTreeSubtreeSize(tree, node); |
909 size_t subtree_size = cxTreeSubtreeSize(tree, node); |
905 cx_tree_unlink(node, cx_tree_node_layout(tree)); |
910 cx_tree_unlink(node, cx_tree_node_layout(tree)); |
906 tree->size -= subtree_size; |
911 tree->size -= subtree_size; |
907 } |
912 } |