Global: drop json-c and switch to yyjson

This commit is contained in:
李通洲
2023-06-10 15:01:54 +08:00
parent 174e1f9d4b
commit abe0d2ca78
116 changed files with 650 additions and 859 deletions
+10 -5
View File
@@ -1,4 +1,5 @@
#include "common/printing.h"
#include "common/jsonconfig.h"
#include "detection/bluetooth/bluetooth.h"
#include "modules/bluetooth/bluetooth.h"
@@ -84,22 +85,27 @@ void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
ffOptionDestroyModuleArg(&options->moduleArgs);
}
#ifdef FF_HAVE_JSONC
void ffParseBluetoothJsonObject(FFinstance* instance, json_object* module)
void ffParseBluetoothJsonObject(FFinstance* instance, yyjson_val* module)
{
FFBluetoothOptions __attribute__((__cleanup__(ffDestroyBluetoothOptions))) options;
ffInitBluetoothOptions(&options);
if (module)
{
json_object_object_foreach(module, key, val)
yyjson_val *key_, *val;
size_t idx, max;
yyjson_obj_foreach(module, idx, max, key_, val)
{
const char* key = yyjson_get_str(key_);
if(strcasecmp(key, "type") == 0)
continue;
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
continue;
if (strcasecmp(key, "showConnected") == 0)
{
options.showDisconnected = json_object_get_boolean(val);
options.showDisconnected = yyjson_get_bool(val);
continue;
}
@@ -109,4 +115,3 @@ void ffParseBluetoothJsonObject(FFinstance* instance, json_object* module)
ffPrintBluetooth(instance, &options);
}
#endif
+2 -5
View File
@@ -1,6 +1,7 @@
#pragma once
#include "fastfetch.h"
#include <yyjson.h>
#define FF_BLUETOOTH_MODULE_NAME "Bluetooth"
@@ -8,8 +9,4 @@ void ffPrintBluetooth(FFinstance* instance, FFBluetoothOptions* options);
void ffInitBluetoothOptions(FFBluetoothOptions* options);
bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key, const char* value);
void ffDestroyBluetoothOptions(FFBluetoothOptions* options);
#ifdef FF_HAVE_JSONC
#include "common/jsonconfig.h"
void ffParseBluetoothJsonObject(FFinstance* instance, json_object* module);
#endif
void ffParseBluetoothJsonObject(FFinstance* instance, yyjson_val* module);