X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=src%2FVector.c;h=a303d54805a4e63d7d5e7dd31d28c051522e99b1;hb=8306616e3ab3b2cbcbaf7dc70931d2ed394a1aa5;hp=2d00985445f6bae8b9a5f5f06d7961377313b587;hpb=a78687686f5b490d99fae21f9fa8aaa9a34f1812;p=cgds.git diff --git a/src/Vector.c b/src/Vector.c index 2d00985..a303d54 100644 --- a/src/Vector.c +++ b/src/Vector.c @@ -82,6 +82,15 @@ void vector_pop(Vector* vector) _vector_realloc(vector, vector->capacity >> 1); } +void vector_pop_first(Vector* vector) +{ + safe_free(vector->datas[0]); + vector->datas++; + vector->size--; + if (vector_size(vector) <= (vector->capacity >> 1)) + _vector_realloc(vector, vector->capacity >> 1); +} + void* _vector_get(Vector* vector, UInt index) { return vector->datas[index];