summaryrefslogtreecommitdiff
path: root/lib/vector.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vector.c')
-rw-r--r--lib/vector.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/vector.c b/lib/vector.c
index ebac2b46e9..696e260cdf 100644
--- a/lib/vector.c
+++ b/lib/vector.c
@@ -153,6 +153,17 @@ void vector_unset(vector v, unsigned int i)
}
}
+void vector_remove(vector v, unsigned int ix)
+{
+ if (ix >= v->active)
+ return;
+
+ int n = (--v->active) - ix;
+
+ memmove(&v->index[ix], &v->index[ix + 1], n * sizeof(void *));
+ v->index[v->active] = NULL;
+}
+
void vector_unset_value(vector v, void *val)
{
size_t i;