src/tree.c

changeset 907
1f72fb9af87e
parent 905
39aa4f106a71
child 908
f49f8a7060aa
equal deleted inserted replaced
906:b51e5268bd9b 907:1f72fb9af87e
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 }

mercurial