Skip to content

Commit

Permalink
array: mark array_length argument as const
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Oct 10, 2020
1 parent 6c1f442 commit 161e0f7
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 @@ -124,7 +124,7 @@ bool array_remove(Array *arr, size_t idx) {
return true;
}

size_t array_length(Array *arr) {
size_t array_length(const Array *arr) {
return arr->len;
}

Expand Down
2 changes: 1 addition & 1 deletion array.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool array_add_ptr(Array*, void *item);
*/
bool array_remove(Array*, size_t idx);
/** Number of elements currently stored in the array. */
size_t array_length(Array*);
size_t array_length(const Array*);
/** Number of elements which can be stored without enlarging the array. */
size_t array_capacity(Array*);
/** Remove all elements with index greater or equal to ``length``, keep allocated memory. */
Expand Down

0 comments on commit 161e0f7

Please sign in to comment.