diff options
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r-- | collections/vector/vector.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c index c2668e4..afe99de 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -61,3 +61,17 @@ vec *root; assert(root->base); } +void vec_push(root, item) +vec *root; +void *item; +{ + if (!root) { + return; + } + + if (root->end >= root->limit) { + vec_resize(root); + } + + root->base[root->end++] = item; +} |