mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
JsonConfig: simplify code
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include "detection/bluetooth/bluetooth.h"
|
||||
#include "modules/bluetooth/bluetooth.h"
|
||||
|
||||
#define FF_BLUETOOTH_MODULE_NAME "Bluetooth"
|
||||
#define FF_BLUETOOTH_NUM_FORMAT_ARGS 4
|
||||
|
||||
static void printDevice(FFinstance* instance, FFBluetoothOptions* options, const FFBluetoothDevice* device, uint8_t index)
|
||||
@@ -89,11 +88,8 @@ void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
bool ffParseBluetoothJsonObject(FFinstance* instance, const char* type, json_object* module)
|
||||
void ffParseBluetoothJsonObject(FFinstance* instance, json_object* module)
|
||||
{
|
||||
if (strcasecmp(type, FF_BLUETOOTH_MODULE_NAME) != 0)
|
||||
return false;
|
||||
|
||||
FFBluetoothOptions __attribute__((__cleanup__(ffDestroyBluetoothOptions))) options;
|
||||
ffInitBluetoothOptions(&options);
|
||||
|
||||
@@ -101,9 +97,6 @@ bool ffParseBluetoothJsonObject(FFinstance* instance, const char* type, json_obj
|
||||
{
|
||||
json_object_object_foreach(module, key, val)
|
||||
{
|
||||
if (strcasecmp(key, "type") == 0)
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
@@ -118,6 +111,5 @@ bool ffParseBluetoothJsonObject(FFinstance* instance, const char* type, json_obj
|
||||
}
|
||||
|
||||
ffPrintBluetooth(instance, &options);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
#define FF_BLUETOOTH_MODULE_NAME "Bluetooth"
|
||||
|
||||
void ffPrintBluetooth(FFinstance* instance, FFBluetoothOptions* options);
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options);
|
||||
bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key, const char* value);
|
||||
@@ -9,5 +11,5 @@ void ffDestroyBluetoothOptions(FFBluetoothOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
bool ffParseBluetoothJsonObject(FFinstance* instance, const char* type, json_object* module);
|
||||
void ffParseBluetoothJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user