97 * A default stdlib-based array reallocator. |
97 * A default stdlib-based array reallocator. |
98 */ |
98 */ |
99 extern struct cx_array_reallocator_s *cx_array_default_reallocator; |
99 extern struct cx_array_reallocator_s *cx_array_default_reallocator; |
100 |
100 |
101 /** |
101 /** |
102 * Return codes for cx_array_copy(). |
102 * Return codes for array functions. |
103 */ |
103 */ |
104 enum cx_array_copy_result { |
104 enum cx_array_result { |
105 CX_ARRAY_COPY_SUCCESS, |
105 CX_ARRAY_SUCCESS, |
106 CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED, |
106 CX_ARRAY_REALLOC_NOT_SUPPORTED, |
107 CX_ARRAY_COPY_REALLOC_FAILED, |
107 CX_ARRAY_REALLOC_FAILED, |
108 }; |
108 }; |
109 |
109 |
110 /** |
110 /** |
111 * Copies elements from one array to another. |
111 * Copies elements from one array to another. |
112 * |
112 * |
130 * @param elem_count the number of elements to copy |
130 * @param elem_count the number of elements to copy |
131 * @param reallocator the array re-allocator to use, or \c NULL |
131 * @param reallocator the array re-allocator to use, or \c NULL |
132 * if re-allocation shall not happen |
132 * if re-allocation shall not happen |
133 * @return zero on success, non-zero error code on failure |
133 * @return zero on success, non-zero error code on failure |
134 */ |
134 */ |
135 enum cx_array_copy_result cx_array_copy( |
135 enum cx_array_result cx_array_copy( |
136 void **target, |
136 void **target, |
137 size_t *size, |
137 size_t *size, |
138 size_t *capacity, |
138 size_t *capacity, |
139 size_t index, |
139 size_t index, |
140 void const *src, |
140 void const *src, |