Refactor disk module

This commit is contained in:
Linus Dierheimer
2022-09-06 13:24:57 +02:00
parent 10973dd9d1
commit 9ef4b82cb9
2 changed files with 69 additions and 55 deletions
+7
View File
@@ -242,6 +242,9 @@ int ffStrbufIgnCaseCompS(const FFstrbuf* strbuf, const char* comp)
void ffStrbufTrimLeft(FFstrbuf* strbuf, char c)
{
if(strbuf->allocated == 0)
return;
uint32_t index = 0;
while(index < strbuf->length && strbuf->chars[index] == c)
++index;
@@ -256,8 +259,12 @@ void ffStrbufTrimLeft(FFstrbuf* strbuf, char c)
void ffStrbufTrimRight(FFstrbuf* strbuf, char c)
{
if(strbuf->allocated == 0)
return;
while(ffStrbufEndsWithC(strbuf, c))
--strbuf->length;
strbuf->chars[strbuf->length] = '\0';
}