diff options
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r-- | collections/vector/vector.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c index 936c0c8..9544917 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -96,3 +96,25 @@ vec *root; return root->base[--root->end]; } + +void vec_free(root) +vec *root; +{ + free(root->base); + root->base = NULL; + + free(root); +} + +void vec_clear(root) +vec *root; +{ + int i; + + for (i = 0; i < root->end; i++) { + free(vec_index(root, i)); + } + + root->end = 0; +} + |