Skip to content

Commit

Permalink
array: mark array_get argument as const
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Oct 10, 2020
1 parent 161e0f7 commit 78c4116
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78c4116

Please sign in to comment.