mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Destroyed FFstrbufs can now be reused
This commit is contained in:
@@ -31,6 +31,12 @@ void ffStrbufInitCopy(FFstrbuf* strbuf, const FFstrbuf* src)
|
||||
|
||||
static void setCapacity(FFstrbuf* strbuf, uint32_t capacity)
|
||||
{
|
||||
if(capacity == 0)
|
||||
{
|
||||
ffStrbufDestroy(strbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if(strbuf->allocated == 0)
|
||||
{
|
||||
strbuf->chars = malloc(sizeof(*strbuf->chars) * capacity);
|
||||
@@ -530,4 +536,5 @@ void ffStrbufDestroy(FFstrbuf* strbuf)
|
||||
{
|
||||
free(strbuf->chars);
|
||||
strbuf->allocated = 0;
|
||||
strbuf->length = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user