mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[common] vector: implement a clear operation
This commit is contained in:
parent
b71838a530
commit
07d3d6cbe7
@ -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, \
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user