--- a/src/array.c Thu Jul 04 22:23:15 2019 +0200 +++ b/src/array.c Thu Jul 04 22:32:03 2019 +0200 @@ -143,6 +143,24 @@ return 0; } +int ucx_array_set(UcxArray *array, size_t index, void *data) { + if (index >= array->size) { + if (ucx_array_reserve(array, index+1)) { + return 1; + } + array->size = index+1; + } + + void *dest = ucx_array_at(*array, index); + if (data) { + memcpy(dest, data, array->elemsize); + } else { + memset(dest, 0, array->elemsize); + } + + return 0; +} + int ucx_array_concat(UcxArray *array1, const UcxArray *array2) { if (array1->elemsize != array2->elemsize)