aboutsummaryrefslogtreecommitdiff
path: root/collections/vector
diff options
context:
space:
mode:
authorTucker Evans <tucker@tuckerevans.com>2020-07-01 16:43:07 -0400
committerTucker Evans <tucker@tuckerevans.com>2020-07-01 16:47:01 -0400
commitbc9e78bb7e3fd57a3683e6c8a848b5769d2b21f7 (patch)
tree46da2aff2d9631a41a7cc7dfdf46051382a86f3a /collections/vector
parent65ddeea23e1303d0b2d9656601b90df138d19e6c (diff)
Add resize function for vector
Diffstat (limited to 'collections/vector')
-rw-r--r--collections/vector/vector.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c
index 2c75bc1..c2668e4 100644
--- a/collections/vector/vector.c
+++ b/collections/vector/vector.c
@@ -51,3 +51,13 @@ vec *root;
return root->end;
}
+void vec_resize(root)
+vec *root;
+{
+ if (!root)
+ return;
+
+ root->base = reallocarray(root->base, root->limit * 2, sizeof(void*));
+ assert(root->base);
+}
+