src/cx/array_list.h

changeset 1318
12fa1d37fe48
parent 1239
b4b1f15d1866
child 1319
aa1f580f8f59
--- a/src/cx/array_list.h	Thu May 15 15:43:30 2025 +0200
+++ b/src/cx/array_list.h	Thu May 15 16:02:54 2025 +0200
@@ -123,7 +123,8 @@
  * @endcode
  *
  *
- * The memory for the array is allocated with stdlib malloc().
+ * The memory for the array is allocated with the cxDefaultAllocator.
+ *
  * @param array the name of the array
  * @param capacity the initial capacity
  * @see cx_array_initialize_a()
@@ -133,7 +134,7 @@
 #define cx_array_initialize(array, capacity) \
         array##_capacity = capacity; \
         array##_size = 0; \
-        array = malloc(sizeof(array[0]) * capacity)
+        array = cxMalloc(cxDefaultAllocator, sizeof(array[0]) * capacity)
 
 /**
  * Initializes an array with the given capacity using the specified allocator.
@@ -149,7 +150,6 @@
  * cxFree(al, myarray); // don't forget to free with same allocator
  * @endcode
  *
- * The memory for the array is allocated with stdlib malloc().
  * @param allocator (@c CxAllocator*) the allocator
  * @param array the name of the array
  * @param capacity the initial capacity
@@ -217,7 +217,7 @@
 typedef struct cx_array_reallocator_s CxArrayReallocator;
 
 /**
- * A default stdlib-based array reallocator.
+ * A default array reallocator that is based on the cxDefaultAllocator.
  */
 cx_attr_export
 extern CxArrayReallocator *cx_array_default_reallocator;
@@ -225,7 +225,7 @@
 /**
  * Creates a new array reallocator.
  *
- * When @p allocator is @c NULL, the stdlib default allocator will be used.
+ * When @p allocator is @c NULL, the cxDefaultAllocator will be used.
  *
  * When @p stackmem is not @c NULL, the reallocator is supposed to be used
  * @em only for the specific array that is initially located at @p stackmem.
@@ -699,7 +699,7 @@
  * to cx_cmp_ptr(), if none is given.
  *
  * @param allocator the allocator for allocating the list memory
- * (if @c NULL, a default stdlib allocator will be used)
+ * (if @c NULL, the cxDefaultAllocator will be used)
  * @param comparator the comparator for the elements
  * (if @c NULL, and the list is not storing pointers, sort and find
  * functions will not work)

mercurial