930 * that would cause a double-free in most scenarios where the advanced |
930 * that would cause a double-free in most scenarios where the advanced |
931 * destructor is already freeing the memory. |
931 * destructor is already freeing the memory. |
932 * |
932 * |
933 * @param tree the tree to free |
933 * @param tree the tree to free |
934 */ |
934 */ |
935 static inline void cxTreeFree(CxTree *tree) { |
935 void cxTreeFree(CxTree *tree); |
936 if (tree == NULL) return; |
|
937 if (tree->root != NULL) { |
|
938 cxTreeClear(tree); |
|
939 } |
|
940 cxFree(tree->allocator, tree); |
|
941 } |
|
942 |
936 |
943 /** |
937 /** |
944 * Creates a new tree structure based on the specified layout. |
938 * Creates a new tree structure based on the specified layout. |
945 * |
939 * |
946 * The specified @p allocator will be used for creating the tree struct |
940 * The specified @p allocator will be used for creating the tree struct |