aboutsummaryrefslogtreecommitdiff
path: root/collections/vector/vector.c
diff options
context:
space:
mode:
authorTucker Evans <tucker@tuckerevans.com>2020-07-03 00:57:58 -0400
committerTucker Evans <tucker@tuckerevans.com>2020-07-04 23:10:16 -0400
commitb253b373ea74539a0f29a88ac2be728aa8158d2a (patch)
treecffba7f4788d4710080145b568882c279bc109e8 /collections/vector/vector.c
parentf900066b813fac2f34798c39f16dacda9a878610 (diff)
Add set index function for vectors
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r--collections/vector/vector.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c
index 0b816b7..5cb56ef 100644
--- a/collections/vector/vector.c
+++ b/collections/vector/vector.c
@@ -152,6 +152,17 @@ vec *root;
return root->base[root->end - 1];
}
+void vec_set(root, index, item)
+vec *root;
+int index;
+void *item;
+{
+ if (!root || index >= root->end || index < 0)
+ return;
+
+ root->base[index] = item;
+}
+
void* vec_index(root, index)
vec *root;
int index;