mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-03 11:44:18 +01:00
Global: drop json-c and switch to yyjson
This commit is contained in:
+9
-5
@@ -1,5 +1,5 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "modules/de/de.h"
|
||||
|
||||
@@ -60,16 +60,21 @@ void ffDestroyDEOptions(FFDEOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
void ffParseDEJsonObject(FFinstance* instance, json_object* module)
|
||||
void ffParseDEJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
{
|
||||
FFDEOptions __attribute__((__cleanup__(ffDestroyDEOptions))) options;
|
||||
ffInitDEOptions(&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;
|
||||
|
||||
@@ -79,4 +84,3 @@ void ffParseDEJsonObject(FFinstance* instance, json_object* module)
|
||||
|
||||
ffPrintDE(instance, &options);
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-5
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include <yyjson.h>
|
||||
|
||||
#define FF_DE_MODULE_NAME "DE"
|
||||
|
||||
@@ -8,8 +9,4 @@ void ffPrintDE(FFinstance* instance, FFDEOptions* options);
|
||||
void ffInitDEOptions(FFDEOptions* options);
|
||||
bool ffParseDECommandOptions(FFDEOptions* options, const char* key, const char* value);
|
||||
void ffDestroyDEOptions(FFDEOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
void ffParseDEJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
void ffParseDEJsonObject(FFinstance* instance, yyjson_val* module);
|
||||
|
||||
Reference in New Issue
Block a user