Global: major FFstrbuf related code refactor

This commit is contained in:
李通洲
2023-04-15 15:29:54 +08:00
parent 2df1305521
commit c7119498a3
76 changed files with 274 additions and 537 deletions
@@ -281,8 +281,7 @@ static void getUserShellFromEnv(const FFinstance* instance, FFTerminalShellResul
static void getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
{
FFstrbuf command;
ffStrbufInit(&command);
FF_STRBUF_AUTO_DESTROY command = ffStrbufCreate();
ffStrbufAppendS(&command, "printf \"%s\" \"$");
ffStrbufAppendTransformS(&command, exeName, toupper);
ffStrbufAppendS(&command, "_VERSION\"");
@@ -297,8 +296,6 @@ static void getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf*
});
ffStrbufSubstrBeforeFirstC(version, '(');
ffStrbufRemoveStrings(version, 2, "-release", "release");
ffStrbufDestroy(&command);
}
bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version);