diff --git a/array.c b/array.c index 97bbb3023..0f1e1f0a7 100644 --- a/array.c +++ b/array.c @@ -55,7 +55,7 @@ void array_clear(Array *arr) { memset(arr->items, 0, arr->count * arr->elem_size); } -void *array_get(Array *arr, size_t idx) { +void *array_get(const Array *arr, size_t idx) { if (idx >= arr->len) { errno = EINVAL; return NULL; diff --git a/array.h b/array.h index fa26a4eb7..6c9d8a867 100644 --- a/array.h +++ b/array.h @@ -66,7 +66,7 @@ bool array_reserve(Array*, size_t count); * of new elements) might invalidate the pointer. * @endrst */ -void *array_get(Array*, size_t idx); +void *array_get(const Array*, size_t idx); /** * Set array element. * @rst