diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-07-04 22:06:49 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-07-04 23:14:20 -0400 |
commit | 8874cf97227139ed10e75fe13108988b45492172 (patch) | |
tree | f9e3bb5305f1463ee2cebb924107b133cd551817 /collections/vector/vector.c | |
parent | a1d4279c40612e6f98564db43192929b41c59d40 (diff) |
Add truncate to vectors
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r-- | collections/vector/vector.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c index 5c473a4..c456d8a 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -237,6 +237,16 @@ int i; return vec_pop(root); } +void vec_truncate(root, size) +vec *root; +int size; +{ + if (!root || size < 0 || size >= root->end) + return; + + root->end = size; +} + void vec_clear(root) vec *root; { |