src/tree.c

changeset 989
8aa57a7fecc4
parent 988
15b3ca7ee33f
child 1040
1ecf4dbbc60c
--- a/src/tree.c	Mon Nov 18 22:05:42 2024 +0100
+++ b/src/tree.c	Sat Nov 23 14:45:32 2024 +0100
@@ -808,6 +808,13 @@
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next
 ) {
+    if (allocator == NULL) {
+        allocator = cxDefaultAllocator;
+    }
+    assert(create_func != NULL);
+    assert(search_func != NULL);
+    assert(search_data_func != NULL);
+
     CxTree *tree = cxMalloc(allocator, sizeof(CxTree));
     if (tree == NULL) return NULL;
 
@@ -839,6 +846,11 @@
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next
 ) {
+    if (allocator == NULL) {
+        allocator = cxDefaultAllocator;
+    }
+    assert(root != NULL);
+
     CxTree *tree = cxMalloc(allocator, sizeof(CxTree));
     if (tree == NULL) return NULL;
 

mercurial