[common] vector: allow inplace construction with vector_push

This makes vector_push return a pointer to the pushed element.

It also allows the user to push a NULL pointer, which means allocating the
memory for the element but do not copy anything into it.
This commit is contained in:
Quantum
2021-08-22 08:09:29 -04:00
committed by Geoffrey McRae
parent 07d3d6cbe7
commit 53b4b4818b
2 changed files with 7 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ Vector;
Vector * vector_create(size_t itemSize, size_t capacity);
void vector_free(Vector * vector);
bool vector_push(Vector * vector, void * item);
void * vector_push(Vector * vector, void * item);
void vector_pop(Vector * vector);
size_t vector_size(Vector * vector);
void * vector_data(Vector * vector);