ucx/cx/array_list.h

changeset 1034
330b415910bd
parent 1016
ccde46662db7
equal deleted inserted replaced
1033:eda1ff20cb27 1034:330b415910bd
278 * 278 *
279 * When the capacity is not enough to hold the new element, a re-allocation is attempted. 279 * When the capacity is not enough to hold the new element, a re-allocation is attempted.
280 * 280 *
281 * @param allocator (@c CxAllocator*) the allocator to use for a possible reallocation 281 * @param allocator (@c CxAllocator*) the allocator to use for a possible reallocation
282 * @param array the name of the array where the element shall be added 282 * @param array the name of the array where the element shall be added
283 * @param element (@c void*) a pointer to the element that shall be added 283 * @param element the element that shall be added
284 * @retval zero success 284 * @retval zero success
285 * @retval non-zero a re-allocation was necessary but failed 285 * @retval non-zero a re-allocation was necessary but failed
286 */ 286 */
287 #define cx_array_add_a(allocator, array, element) \ 287 #define cx_array_add_a(allocator, array, element) \
288 cx_array_insert_(allocator, (CxArray*)&(array), sizeof((array).data[0]), (array).size, element, 1) 288 cx_array_insert_(allocator, (CxArray*)&(array), sizeof((array).data[0]), (array).size, (void*)&(element), 1)
289 289
290 /** 290 /**
291 * Appends an element to an array. 291 * Appends an element to an array.
292 * 292 *
293 * When the capacity is not enough to hold the new element, a re-allocation is attempted. 293 * When the capacity is not enough to hold the new element, a re-allocation is attempted.
306 * When the capacity is not enough to hold the new element, a re-allocation is attempted. 306 * When the capacity is not enough to hold the new element, a re-allocation is attempted.
307 * 307 *
308 * @param allocator (@c CxAllocator*) the allocator to use for a possible reallocation 308 * @param allocator (@c CxAllocator*) the allocator to use for a possible reallocation
309 * @param array the name of the array where the element shall be inserted 309 * @param array the name of the array where the element shall be inserted
310 * @param index (@c size_t) the index where to insert the @p element 310 * @param index (@c size_t) the index where to insert the @p element
311 * @param element (@c void*) a pointer to the element that shall be inserted 311 * @param element the element that shall be inserted
312 * @retval zero success 312 * @retval zero success
313 * @retval non-zero a re-allocation was necessary but failed 313 * @retval non-zero a re-allocation was necessary but failed
314 */ 314 */
315 #define cx_array_insert_a(allocator, array, index, element) \ 315 #define cx_array_insert_a(allocator, array, index, element) \
316 cx_array_insert_(allocator, (CxArray*)&(array), sizeof((array).data[0]), index, element, 1) 316 cx_array_insert_(allocator, (CxArray*)&(array), sizeof((array).data[0]), index, (void*)&(element), 1)
317 317
318 /** 318 /**
319 * Inserts an element into an array. 319 * Inserts an element into an array.
320 * 320 *
321 * When the capacity is not enough to hold the new element, a re-allocation is attempted. 321 * When the capacity is not enough to hold the new element, a re-allocation is attempted.

mercurial