mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
26 lines
642 B
C
26 lines
642 B
C
#include "common/FFlist.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
bool ffListShift(FFlist* list, uint32_t elementSize, void* __restrict result) {
|
|
if (list->length == 0) {
|
|
return false;
|
|
}
|
|
|
|
memcpy(result, list->data, elementSize);
|
|
memmove(list->data, list->data + elementSize, (size_t) elementSize * (list->length - 1));
|
|
--list->length;
|
|
return true;
|
|
}
|
|
|
|
bool ffListPop(FFlist* list, uint32_t elementSize, void* __restrict result) {
|
|
if (list->length == 0) {
|
|
return false;
|
|
}
|
|
|
|
memcpy(result, ffListGet(list, elementSize, list->length - 1), elementSize);
|
|
--list->length;
|
|
return true;
|
|
}
|