vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 92bb6f4f8c32839ae57c305eb8b4c6d223159317 parent d6d4a908004424db158c865bd3036e026916125a Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 18 Apr 2017 19:02:24 +0200 array: implement array_capacity Diffstat:
| M | array.c | | | 4 | ++++ |
| M | array.h | | | 2 | ++ |
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/array.c b/array.c @@ -123,3 +123,7 @@ bool array_remove(Array *arr, size_t idx) { size_t array_length(Array *arr) { return arr->len; } + +size_t array_capacity(Array *arr) { + return arr->count; +} diff --git a/array.h b/array.h @@ -54,5 +54,7 @@ bool array_add_ptr(Array*, void *item); bool array_remove(Array*, size_t idx); /* return the number of elements currently stored in the array */ size_t array_length(Array*); +/* return the number of elements which can be stored without enlarging the array */ +size_t array_capacity(Array*); #endif