Global: make FFinstance instance a global variable

As discussed in https://github.com/fastfetch-cli/fastfetch/discussions/473
This commit is contained in:
李通洲
2023-06-24 10:59:53 +08:00
parent 48b01c9665
commit d0f093c567
255 changed files with 2020 additions and 2064 deletions
@@ -262,9 +262,9 @@ static void getTerminalFromEnv(FFTerminalShellResult* result)
}
}
static void getUserShellFromEnv(const FFinstance* instance, FFTerminalShellResult* result)
static void getUserShellFromEnv(FFTerminalShellResult* result)
{
ffStrbufSet(&result->userShellExe, &instance->state.platform.userShell);
ffStrbufSet(&result->userShellExe, &instance.state.platform.userShell);
if(result->userShellExe.length == 0)
return;
@@ -309,10 +309,8 @@ static void getShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* versio
bool fftsGetTerminalVersion(FFstrbuf* processName, FFstrbuf* exe, FFstrbuf* version);
const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
const FFTerminalShellResult* ffDetectTerminalShell()
{
FF_UNUSED(instance);
static FFThreadMutex mutex = FF_THREAD_MUTEX_INITIALIZER;
static FFTerminalShellResult result;
static bool init = false;
@@ -350,7 +348,7 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
getTerminalShell(&result, getppid());
getTerminalFromEnv(&result);
getUserShellFromEnv(instance, &result);
getUserShellFromEnv(&result);
ffStrbufClear(&result.shellVersion);
getShellVersion(&result.shellExe, result.shellExeName, &result.shellVersion);