aboutsummaryrefslogtreecommitdiff
path: root/collections/vector/vector.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r--collections/vector/vector.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c
index 2ae748f..5c473a4 100644
--- a/collections/vector/vector.c
+++ b/collections/vector/vector.c
@@ -191,6 +191,22 @@ void *item;
root->base[index] = item;
}
+void* vec_remove(root, index)
+vec *root;
+int index;
+{
+ void *tmp;
+
+ if (!root || index > root->end || index < 0)
+ return NULL;
+
+ tmp = vec_index(root, index);
+ memmove(root->base + index, root->base + index + 1,
+ (--root->end - index) * sizeof(void*));
+
+ return tmp;
+}
+
void vec_swap(root, i, j)
vec *root;
int i,j;