124 ) { |
124 ) { |
125 // assert pointers |
125 // assert pointers |
126 assert(array != NULL); |
126 assert(array != NULL); |
127 assert(size != NULL); |
127 assert(size != NULL); |
128 assert(capacity != NULL); |
128 assert(capacity != NULL); |
129 assert(reallocator != NULL); |
129 |
|
130 // default reallocator |
|
131 if (reallocator == NULL) { |
|
132 reallocator = cx_array_default_reallocator; |
|
133 } |
130 |
134 |
131 // determine size and capacity |
135 // determine size and capacity |
132 size_t oldcap; |
136 size_t oldcap; |
133 size_t oldsize; |
137 size_t oldsize; |
134 size_t max_size; |
138 size_t max_size; |
217 // assert pointers |
221 // assert pointers |
218 assert(target != NULL); |
222 assert(target != NULL); |
219 assert(size != NULL); |
223 assert(size != NULL); |
220 assert(capacity != NULL); |
224 assert(capacity != NULL); |
221 assert(src != NULL); |
225 assert(src != NULL); |
222 assert(reallocator != NULL); |
226 |
|
227 // default reallocator |
|
228 if (reallocator == NULL) { |
|
229 reallocator = cx_array_default_reallocator; |
|
230 } |
223 |
231 |
224 // determine size and capacity |
232 // determine size and capacity |
225 size_t oldcap; |
233 size_t oldcap; |
226 size_t oldsize; |
234 size_t oldsize; |
227 size_t max_size; |
235 size_t max_size; |
339 assert(target != NULL); |
347 assert(target != NULL); |
340 assert(size != NULL); |
348 assert(size != NULL); |
341 assert(capacity != NULL); |
349 assert(capacity != NULL); |
342 assert(cmp_func != NULL); |
350 assert(cmp_func != NULL); |
343 assert(sorted_data != NULL); |
351 assert(sorted_data != NULL); |
344 assert(reallocator != NULL); |
352 |
|
353 // default reallocator |
|
354 if (reallocator == NULL) { |
|
355 reallocator = cx_array_default_reallocator; |
|
356 } |
345 |
357 |
346 // corner case |
358 // corner case |
347 if (elem_count == 0) return 0; |
359 if (elem_count == 0) return 0; |
348 |
360 |
349 // overflow check |
361 // overflow check |