mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
FFlist: adds ffListReserve
This commit is contained in:
@@ -6,11 +6,7 @@
|
||||
void* ffListAdd(FFlist* list)
|
||||
{
|
||||
if(list->length == list->capacity)
|
||||
{
|
||||
list->capacity = list->capacity == 0 ? FF_LIST_DEFAULT_ALLOC : list->capacity * 2;
|
||||
// realloc(NULL, newSize) is same as malloc(newSize)
|
||||
list->data = realloc(list->data, (size_t)list->capacity * list->elementSize);
|
||||
}
|
||||
ffListReserve(list, list->capacity == 0 ? FF_LIST_DEFAULT_ALLOC : list->capacity * 2);
|
||||
|
||||
++list->length;
|
||||
return ffListGet(list, list->length - 1);
|
||||
|
||||
Reference in New Issue
Block a user