diff -r 6d7aa8a1a3b3 -r f695ae118460 src/ucx/array.h --- a/src/ucx/array.h Thu Jul 04 22:23:15 2019 +0200 +++ b/src/ucx/array.h Thu Jul 04 22:32:03 2019 +0200 @@ -158,6 +158,20 @@ */ int ucx_array_prepend(UcxArray *array, void *data); + +/** + * Sets an element at the specified index. + * + * If the index is out of bounds, the array automatically grows. + * The pointer to the data may be NULL, in which case the element is zeroed. + * + * @param array a pointer the array where to set the data + * @param index the index of the element to set + * @param data a pointer to the data to insert (may be NULL) + * @return zero on success, non-zero if a reallocation was necessary but failed + */ +int ucx_array_set(UcxArray *array, size_t index, void *data); + /** * Concatenates two arrays. *