mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
JsonConfig: simplify code
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "detection/host/host.h"
|
||||
#include "modules/host/host.h"
|
||||
|
||||
#define FF_HOST_MODULE_NAME "Host"
|
||||
#define FF_HOST_NUM_FORMAT_ARGS 5
|
||||
|
||||
void ffPrintHost(FFinstance* instance, FFHostOptions* options)
|
||||
@@ -77,11 +76,8 @@ void ffDestroyHostOptions(FFHostOptions* options)
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
bool ffParseHostJsonObject(FFinstance* instance, const char* type, json_object* module)
|
||||
void ffParseHostJsonObject(FFinstance* instance, json_object* module)
|
||||
{
|
||||
if (strcasecmp(type, FF_HOST_MODULE_NAME) != 0)
|
||||
return false;
|
||||
|
||||
FFHostOptions __attribute__((__cleanup__(ffDestroyHostOptions))) options;
|
||||
ffInitHostOptions(&options);
|
||||
|
||||
@@ -89,9 +85,6 @@ bool ffParseHostJsonObject(FFinstance* instance, const char* type, json_object*
|
||||
{
|
||||
json_object_object_foreach(module, key, val)
|
||||
{
|
||||
if (strcasecmp(key, "type") == 0)
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
@@ -100,6 +93,5 @@ bool ffParseHostJsonObject(FFinstance* instance, const char* type, json_object*
|
||||
}
|
||||
|
||||
ffPrintHost(instance, &options);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
#define FF_HOST_MODULE_NAME "Host"
|
||||
|
||||
void ffPrintHost(FFinstance* instance, FFHostOptions* options);
|
||||
void ffInitHostOptions(FFHostOptions* options);
|
||||
bool ffParseHostCommandOptions(FFHostOptions* options, const char* key, const char* value);
|
||||
@@ -9,5 +11,5 @@ void ffDestroyHostOptions(FFHostOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
bool ffParseHostJsonObject(FFinstance* instance, const char* type, json_object* module);
|
||||
void ffParseHostJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user