mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
Global: drop json-c and switch to yyjson
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "modules/kernel/kernel.h"
|
||||
|
||||
#define FF_KERNEL_NUM_FORMAT_ARGS 4
|
||||
@@ -50,16 +50,21 @@ void ffDestroyKernelOptions(FFKernelOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
void ffParseKernelJsonObject(FFinstance* instance, json_object* module)
|
||||
void ffParseKernelJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
{
|
||||
FFKernelOptions __attribute__((__cleanup__(ffDestroyKernelOptions))) options;
|
||||
ffInitKernelOptions(&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;
|
||||
|
||||
@@ -69,4 +74,3 @@ void ffParseKernelJsonObject(FFinstance* instance, json_object* module)
|
||||
|
||||
ffPrintKernel(instance, &options);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user