src/array_list.c

changeset 1089
865c84fef6b4
parent 1084
0bcd71d2615a
child 1111
78eeeb950883
--- a/src/array_list.c	Sat Jan 04 14:18:27 2025 +0100
+++ b/src/array_list.c	Sat Jan 04 14:19:11 2025 +0100
@@ -126,7 +126,11 @@
     assert(array != NULL);
     assert(size != NULL);
     assert(capacity != NULL);
-    assert(reallocator != NULL);
+
+    // default reallocator
+    if (reallocator == NULL) {
+        reallocator = cx_array_default_reallocator;
+    }
 
     // determine size and capacity
     size_t oldcap;
@@ -219,7 +223,11 @@
     assert(size != NULL);
     assert(capacity != NULL);
     assert(src != NULL);
-    assert(reallocator != NULL);
+
+    // default reallocator
+    if (reallocator == NULL) {
+        reallocator = cx_array_default_reallocator;
+    }
 
     // determine size and capacity
     size_t oldcap;
@@ -341,7 +349,11 @@
     assert(capacity != NULL);
     assert(cmp_func != NULL);
     assert(sorted_data != NULL);
-    assert(reallocator != NULL);
+
+    // default reallocator
+    if (reallocator == NULL) {
+        reallocator = cx_array_default_reallocator;
+    }
 
     // corner case
     if (elem_count == 0) return 0;

mercurial