diff -r 862ab606ee06 -r 04c9f8d8f03b ucx/tree.c --- a/ucx/tree.c Sun Feb 16 17:38:07 2025 +0100 +++ b/ucx/tree.c Tue Feb 25 21:12:11 2025 +0100 @@ -42,6 +42,13 @@ #define cx_tree_ptr_locations \ loc_parent, loc_children, loc_last_child, loc_prev, loc_next +#define cx_tree_node_layout(tree) \ + (tree)->loc_parent,\ + (tree)->loc_children,\ + (tree)->loc_last_child,\ + (tree)->loc_prev, \ + (tree)->loc_next + static void cx_tree_zero_pointers( void *node, ptrdiff_t loc_parent, @@ -742,7 +749,7 @@ static size_t cx_tree_default_insert_many( CxTree *tree, - struct cx_iterator_base_s *iter, + CxIteratorBase *iter, size_t n ) { size_t ins = 0; @@ -837,6 +844,14 @@ return tree; } +void cxTreeFree(CxTree *tree) { + if (tree == NULL) return; + if (tree->root != NULL) { + cxTreeClear(tree); + } + cxFree(tree->allocator, tree); +} + CxTree *cxTreeCreateWrapped( const CxAllocator *allocator, void *root,