made popping with lists work. yay! (also new demo to show the thing)
This commit is contained in:
+12
@@ -106,3 +106,15 @@ listCleanup(list_t* l) {
|
||||
vectorCleanup((vector_t *)l->data);
|
||||
free(l);
|
||||
}
|
||||
|
||||
void*
|
||||
listPop(list_t* l) {
|
||||
vector_t *first_ptr = (vector_t *)vectorPop((vector_t *)l->data);
|
||||
void *ptr = vectorPop(first_ptr);
|
||||
l->size -= 1;
|
||||
|
||||
if (l->size <= l->capacity / 2) l->capacity /= 2;
|
||||
if (l->capacity == 0) l->capacity = 1;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user