mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 01:56:28 +01: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 "detection/media/media.h"
|
||||
#include "modules/player/player.h"
|
||||
|
||||
@@ -97,16 +97,21 @@ void ffDestroyPlayerOptions(FFPlayerOptions* options)
|
||||
ffStrbufDestroy(&options->name);
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
void ffParsePlayerJsonObject(FFinstance* instance, json_object* module)
|
||||
void ffParsePlayerJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
{
|
||||
FFPlayerOptions __attribute__((__cleanup__(ffDestroyPlayerOptions))) options;
|
||||
ffInitPlayerOptions(&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;
|
||||
|
||||
@@ -116,4 +121,3 @@ void ffParsePlayerJsonObject(FFinstance* instance, json_object* module)
|
||||
|
||||
ffPrintPlayer(instance, &options);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include <yyjson.h>
|
||||
|
||||
#define FF_PLAYER_MODULE_NAME "Player"
|
||||
|
||||
@@ -9,8 +10,4 @@ void ffPrintPlayer(FFinstance* instance, FFPlayerOptions* options);
|
||||
void ffInitPlayerOptions(FFPlayerOptions* options);
|
||||
bool ffParsePlayerCommandOptions(FFPlayerOptions* options, const char* key, const char* value);
|
||||
void ffDestroyPlayerOptions(FFPlayerOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
void ffParsePlayerJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
void ffParsePlayerJsonObject(FFinstance* instance, yyjson_val* module);
|
||||
|
||||
Reference in New Issue
Block a user