mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 20:54:21 +01:00
Bios: code refactor
This commit is contained in:
+11
-11
@@ -9,10 +9,10 @@
|
||||
void ffPrintBios(FFinstance* instance, FFBiosOptions* options)
|
||||
{
|
||||
FFBiosResult bios;
|
||||
ffStrbufInit(&bios.biosDate);
|
||||
ffStrbufInit(&bios.date);
|
||||
ffStrbufInit(&bios.biosRelease);
|
||||
ffStrbufInit(&bios.biosVendor);
|
||||
ffStrbufInit(&bios.biosVersion);
|
||||
ffStrbufInit(&bios.vendor);
|
||||
ffStrbufInit(&bios.version);
|
||||
|
||||
const char* error = ffDetectBios(&bios);
|
||||
|
||||
@@ -22,7 +22,7 @@ void ffPrintBios(FFinstance* instance, FFBiosOptions* options)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(bios.biosVersion.length == 0)
|
||||
if(bios.version.length == 0)
|
||||
{
|
||||
ffPrintError(instance, FF_BIOS_MODULE_NAME, 0, &options->moduleArgs, "bios_version is not set.");
|
||||
goto exit;
|
||||
@@ -31,7 +31,7 @@ void ffPrintBios(FFinstance* instance, FFBiosOptions* options)
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, FF_BIOS_MODULE_NAME, 0, &options->moduleArgs.key, &options->moduleArgs.keyColor);
|
||||
ffStrbufWriteTo(&bios.biosVersion, stdout);
|
||||
ffStrbufWriteTo(&bios.version, stdout);
|
||||
if (bios.biosRelease.length)
|
||||
printf(" (%s)", bios.biosRelease.chars);
|
||||
putchar('\n');
|
||||
@@ -39,18 +39,18 @@ void ffPrintBios(FFinstance* instance, FFBiosOptions* options)
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_BIOS_MODULE_NAME, 0, &options->moduleArgs, FF_BIOS_NUM_FORMAT_ARGS, (FFformatarg[]) {
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.biosDate},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.date},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.biosRelease},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.biosVendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.biosVersion},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.vendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.version},
|
||||
});
|
||||
}
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&bios.biosDate);
|
||||
ffStrbufDestroy(&bios.date);
|
||||
ffStrbufDestroy(&bios.biosRelease);
|
||||
ffStrbufDestroy(&bios.biosVendor);
|
||||
ffStrbufDestroy(&bios.biosVersion);
|
||||
ffStrbufDestroy(&bios.vendor);
|
||||
ffStrbufDestroy(&bios.version);
|
||||
}
|
||||
|
||||
void ffInitBiosOptions(FFBiosOptions* options)
|
||||
|
||||
Reference in New Issue
Block a user