diff --git a/common/include/common/vector.h b/common/include/common/vector.h index f167ea06..9d08ddf1 100644 --- a/common/include/common/vector.h +++ b/common/include/common/vector.h @@ -40,6 +40,7 @@ size_t vector_size(Vector * vector); void * vector_data(Vector * vector); void vector_at(Vector * vector, size_t index, void * data); void * vector_ptrTo(Vector * vector, size_t index); +void vector_clear(Vector * vector); #define vector_forEach(name, vector) \ for (char * vecIterCurrent = (vector)->data, \ diff --git a/common/src/vector.c b/common/src/vector.c index 41d84760..66ccd321 100644 --- a/common/src/vector.c +++ b/common/src/vector.c @@ -101,3 +101,8 @@ void * vector_ptrTo(Vector * vector, size_t index) DEBUG_ASSERT(index < vector->size && "Out of bounds access"); return (char *)vector->data + index * vector->itemSize; } + +void vector_clear(Vector * vector) +{ + vector->size = 0; +}