952 * |
952 * |
953 * \note This function will also register an advanced destructor which |
953 * \note This function will also register an advanced destructor which |
954 * will free the nodes with the allocator's free() method. |
954 * will free the nodes with the allocator's free() method. |
955 * |
955 * |
956 * @param allocator the allocator that shall be used |
956 * @param allocator the allocator that shall be used |
|
957 * (if \c NULL, a default stdlib allocator will be used) |
957 * @param create_func a function that creates new nodes |
958 * @param create_func a function that creates new nodes |
958 * @param search_func a function that compares two nodes |
959 * @param search_func a function that compares two nodes |
959 * @param search_data_func a function that compares a node with data |
960 * @param search_data_func a function that compares a node with data |
960 * @param loc_parent offset in the node struct for the parent pointer |
961 * @param loc_parent offset in the node struct for the parent pointer |
961 * @param loc_children offset in the node struct for the children linked list |
962 * @param loc_children offset in the node struct for the children linked list |
965 * @param loc_next offset in the node struct for the next pointer |
966 * @param loc_next offset in the node struct for the next pointer |
966 * @return the new tree |
967 * @return the new tree |
967 * @see cxTreeCreateSimple() |
968 * @see cxTreeCreateSimple() |
968 * @see cxTreeCreateWrapped() |
969 * @see cxTreeCreateWrapped() |
969 */ |
970 */ |
970 cx_attr_nonnull |
971 cx_attr_nonnull_arg(2, 3, 4) |
971 cx_attr_nodiscard |
972 cx_attr_nodiscard |
972 cx_attr_malloc |
973 cx_attr_malloc |
973 cx_attr_dealloc(cxTreeDestroy, 1) |
974 cx_attr_dealloc(cxTreeDestroy, 1) |
974 CxTree *cxTreeCreate( |
975 CxTree *cxTreeCreate( |
975 const CxAllocator *allocator, |
976 const CxAllocator *allocator, |
1014 * where neither the create function, the search function, nor a destructor |
1015 * where neither the create function, the search function, nor a destructor |
1015 * will be set. If you wish to use any of this functionality for the wrapped |
1016 * will be set. If you wish to use any of this functionality for the wrapped |
1016 * tree, you need to specify those functions afterwards. |
1017 * tree, you need to specify those functions afterwards. |
1017 * |
1018 * |
1018 * @param allocator the allocator that was used for nodes of the wrapped tree |
1019 * @param allocator the allocator that was used for nodes of the wrapped tree |
|
1020 * (if \c NULL, a default stdlib allocator is assumed) |
1019 * @param root the root node of the tree that shall be wrapped |
1021 * @param root the root node of the tree that shall be wrapped |
1020 * @param loc_parent offset in the node struct for the parent pointer |
1022 * @param loc_parent offset in the node struct for the parent pointer |
1021 * @param loc_children offset in the node struct for the children linked list |
1023 * @param loc_children offset in the node struct for the children linked list |
1022 * @param loc_last_child optional offset in the node struct for the pointer to |
1024 * @param loc_last_child optional offset in the node struct for the pointer to |
1023 * the last child in the linked list (negative if there is no such pointer) |
1025 * the last child in the linked list (negative if there is no such pointer) |
1024 * @param loc_prev optional offset in the node struct for the prev pointer |
1026 * @param loc_prev optional offset in the node struct for the prev pointer |
1025 * @param loc_next offset in the node struct for the next pointer |
1027 * @param loc_next offset in the node struct for the next pointer |
1026 * @return the new tree |
1028 * @return the new tree |
1027 * @see cxTreeCreate() |
1029 * @see cxTreeCreate() |
1028 */ |
1030 */ |
1029 cx_attr_nonnull |
1031 cx_attr_nonnull_arg(2) |
1030 cx_attr_nodiscard |
1032 cx_attr_nodiscard |
1031 cx_attr_malloc |
1033 cx_attr_malloc |
1032 cx_attr_dealloc(cxTreeDestroy, 1) |
1034 cx_attr_dealloc(cxTreeDestroy, 1) |
1033 CxTree *cxTreeCreateWrapped( |
1035 CxTree *cxTreeCreateWrapped( |
1034 const CxAllocator *allocator, |
1036 const CxAllocator *allocator, |