--- a/ucx/cx/tree.h Sun Dec 07 20:00:33 2025 +0100 +++ b/ucx/cx/tree.h Sat Dec 13 15:58:58 2025 +0100 @@ -88,6 +88,7 @@ ptrdiff_t loc_next; /** * The total number of distinct nodes that have been passed so far. + * This includes the current node. */ size_t counter; /** @@ -185,6 +186,7 @@ ptrdiff_t loc_next; /** * The total number of distinct nodes that have been passed so far. + * This includes the currently visited node. */ size_t counter; /** @@ -641,17 +643,13 @@ * Structure for holding the base data of a tree. */ struct cx_tree_s { + CX_COLLECTION_BASE; /** * The tree class definition. */ const cx_tree_class *cl; /** - * Allocator to allocate new nodes. - */ - const CxAllocator *allocator; - - /** * A pointer to the root node. * * Will be @c NULL when @c size is 0. @@ -669,21 +667,6 @@ cx_tree_node_create_func node_create; /** - * An optional simple destructor for the tree nodes. - */ - cx_destructor_func simple_destructor; - - /** - * An optional advanced destructor for the tree nodes. - */ - cx_destructor_func2 advanced_destructor; - - /** - * The pointer to additional data that is passed to the advanced destructor. - */ - void *destructor_data; - - /** * A function to compare two nodes. */ cx_tree_search_func search; @@ -694,11 +677,6 @@ cx_tree_search_data_func search_data; /** - * The number of currently stored elements. - */ - size_t size; - - /** * Offset in the node struct for the parent pointer. */ ptrdiff_t loc_parent; @@ -1094,7 +1072,7 @@ * @see cxTreeIterate() */ cx_attr_nonnull cx_attr_nodiscard -CxTreeVisitor cxTreeVisit(CxTree *tree); +CX_EXPORT CxTreeVisitor cxTreeVisit(CxTree *tree); /** * Sets the (new) parent of the specified child.