mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Global: make FFinstance instance a global variable
As discussed in https://github.com/fastfetch-cli/fastfetch/discussions/473
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#include "os.h"
|
||||
#include "detection/internal.h"
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance);
|
||||
void ffDetectOSImpl(FFOSResult* os);
|
||||
|
||||
const FFOSResult* ffDetectOS(const FFinstance* instance)
|
||||
const FFOSResult* ffDetectOS(void)
|
||||
{
|
||||
FF_DETECTION_INTERNAL_GUARD(FFOSResult,
|
||||
ffDetectOSImpl(&result, instance)
|
||||
ffDetectOSImpl(&result)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ typedef struct FFOSResult
|
||||
FFstrbuf buildID;
|
||||
} FFOSResult;
|
||||
|
||||
const FFOSResult* ffDetectOS(const FFinstance* instance);
|
||||
const FFOSResult* ffDetectOS();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "os.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
ffStrbufInitS(&os->name, "Android");
|
||||
|
||||
ffStrbufInitS(&os->prettyName, "Android");
|
||||
|
||||
@@ -96,10 +96,8 @@ static void parseOSXSoftwareLicense(FFOSResult* os)
|
||||
fclose(rtf);
|
||||
}
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
ffStrbufInit(&os->name);
|
||||
ffStrbufInit(&os->version);
|
||||
ffStrbufInit(&os->buildID);
|
||||
|
||||
@@ -94,15 +94,15 @@ static void getUbuntuFlavour(FFOSResult* result)
|
||||
}
|
||||
}
|
||||
|
||||
static void detectOS(FFOSResult* os, const FFinstance* instance)
|
||||
static void detectOS(FFOSResult* os)
|
||||
{
|
||||
if(instance->config.osFile.length > 0)
|
||||
if(instance.config.osFile.length > 0)
|
||||
{
|
||||
parseFile(instance->config.osFile.chars, os);
|
||||
parseFile(instance.config.osFile.chars, os);
|
||||
return;
|
||||
}
|
||||
|
||||
if(instance->config.escapeBedrock && parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock"FASTFETCH_TARGET_DIR_ETC"/bedrock-release", os))
|
||||
if(instance.config.escapeBedrock && parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock"FASTFETCH_TARGET_DIR_ETC"/bedrock-release", os))
|
||||
{
|
||||
if(os->id.length == 0)
|
||||
ffStrbufAppendS(&os->id, "bedrock");
|
||||
@@ -127,7 +127,7 @@ static void detectOS(FFOSResult* os, const FFinstance* instance)
|
||||
parseFile(FASTFETCH_TARGET_DIR_ETC"/lsb-release", os);
|
||||
}
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
ffStrbufInit(&os->name);
|
||||
ffStrbufInit(&os->prettyName);
|
||||
@@ -140,7 +140,7 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
ffStrbufInit(&os->codename);
|
||||
ffStrbufInit(&os->buildID);
|
||||
|
||||
detectOS(os, instance);
|
||||
detectOS(os);
|
||||
|
||||
if(ffStrbufIgnCaseCompS(&os->id, "ubuntu") == 0)
|
||||
getUbuntuFlavour(os);
|
||||
|
||||
@@ -44,10 +44,8 @@ static const char* getOsNameByWinbrand(FFstrbuf* osName)
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
ffStrbufInit(&os->name);
|
||||
ffStrbufInit(&os->prettyName);
|
||||
ffStrbufInit(&os->id);
|
||||
|
||||
Reference in New Issue
Block a user