diff -r 563033aa998c -r 83284b289430 src/cx/array_list.h --- a/src/cx/array_list.h Sun Oct 12 20:21:56 2025 +0200 +++ b/src/cx/array_list.h Wed Oct 15 22:45:21 2025 +0200 @@ -172,10 +172,9 @@ * Reallocates space for the given array. * * Implementations are not required to free the original array. - * This allows reallocation of static memory by allocating heap memory - * and copying the array contents. The information in the custom fields of - * the referenced allocator can be used to track the state of the memory - * or to transport other additional data. + * This allows reallocation of static or stack memory by allocating heap memory + * and copying the array contents; namely when @c stack_ptr in this struct + * is not @c NULL and @p array equals @c stack_ptr. * * @param array the array to reallocate * @param old_capacity the old number of elements @@ -196,21 +195,14 @@ ); /** - * Custom data pointer. + * The allocator that shall be used for the reallocations. */ - void *ptr1; - /** - * Custom data pointer. - */ - void *ptr2; + const CxAllocator *allocator; /** - * Custom data integer. + * Optional pointer to stack memory + * if the array is originally located on the stack. */ - size_t int1; - /** - * Custom data integer. - */ - size_t int2; + const void *stack_ptr; }; /** @@ -229,23 +221,23 @@ * * 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 initially located at @p stackmem. + * When @p stack_ptr is not @c NULL, the reallocator is supposed to be used + * @em only for the specific array initially located at @p stack_ptr. * When reallocation is needed, the reallocator checks if the array is - * still located at @p stackmem and copies the contents to the heap. + * still located at @p stack_ptr and copies the contents to the heap. * * @note Invoking this function with both arguments being @c NULL will return a * reallocator that behaves like #cx_array_default_reallocator. * * @param allocator the allocator this reallocator shall be based on - * @param stackmem the address of the array when the array is initially located + * @param stack_ptr the address of the array when the array is initially located * on the stack or shall not reallocate in place * @return an array reallocator */ cx_attr_export CxArrayReallocator cx_array_reallocator( const struct cx_allocator_s *allocator, - const void *stackmem + const void *stack_ptr ); /**