Better ordering in initCacheDir

This commit is contained in:
Linus Dierheimer
2022-06-19 18:21:41 +02:00
parent fb35a6e889
commit 45eae78980
+4 -4
View File
@@ -23,10 +23,6 @@ static void initConfigDirs(FFstate* state)
ffStrbufTrimRight(buffer, '/');
}
FFstrbuf xdgConfigDirs;
ffStrbufInitA(&xdgConfigDirs, 64);
ffStrbufAppendS(&xdgConfigDirs, getenv("XDG_CONFIG_DIRS"));
#define FF_ENSURE_ONLY_ONCE_IN_LIST(element) \
if(ffListFirstIndexComp(&state->configDirs, element, strbufEqualsAdapter) < state->configDirs.length - 1) \
--state->configDirs.length;
@@ -42,6 +38,10 @@ static void initConfigDirs(FFstate* state)
ffStrbufAppendS(userHome, state->passwd->pw_dir);
FF_ENSURE_ONLY_ONCE_IN_LIST(userHome)
FFstrbuf xdgConfigDirs;
ffStrbufInitA(&xdgConfigDirs, 64);
ffStrbufAppendS(&xdgConfigDirs, getenv("XDG_CONFIG_DIRS"));
uint32_t startIndex = 0;
while (startIndex < xdgConfigDirs.length)
{