FFstrbuf: don't do unneeded destroy work

This commit is contained in:
Linus Dierheimer
2022-01-12 02:05:12 +01:00
parent 6d7ad48edf
commit 322e5c5a48
-8
View File
@@ -31,12 +31,6 @@ 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);
@@ -535,6 +529,4 @@ void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file)
void ffStrbufDestroy(FFstrbuf* strbuf)
{
free(strbuf->chars);
strbuf->allocated = 0;
ffStrbufClear(strbuf);
}