Skip to content

Commit

Permalink
array: mark array_get_ptr argument as const
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Oct 10, 2020
1 parent 78c4116 commit 3614dd5
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 @@ -63,7 +63,7 @@ void *array_get(const Array *arr, size_t idx) {
return arr->items + (idx * arr->elem_size);
}

void *array_get_ptr(Array *arr, size_t idx) {
void *array_get_ptr(const Array *arr, size_t idx) {
if (arr->elem_size != sizeof(void*)) {
errno = ENOTSUP;
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion array.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void *array_get(const Array*, size_t idx);
*/
bool array_set(Array*, size_t idx, void *item);
/** Dereference pointer stored in array element. */
void *array_get_ptr(Array*, size_t idx);
void *array_get_ptr(const Array*, size_t idx);
/** Store the address to which ``item`` points to into the array. */
bool array_set_ptr(Array*, size_t idx, void *item);
/** Add element to the end of the array. */
Expand Down

0 comments on commit 3614dd5

Please sign in to comment.