mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Global: drop json-c and switch to yyjson
This commit is contained in:
+11
-7
@@ -1,7 +1,7 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/bar.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/host/host.h"
|
||||
#include "detection/gpu/gpu.h"
|
||||
#include "modules/gpu/gpu.h"
|
||||
@@ -145,28 +145,33 @@ void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
void ffParseGPUJsonObject(FFinstance* instance, json_object* module)
|
||||
void ffParseGPUJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
{
|
||||
FFGPUOptions __attribute__((__cleanup__(ffDestroyGPUOptions))) options;
|
||||
ffInitGPUOptions(&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, "temp") == 0)
|
||||
{
|
||||
options.temp = (bool) json_object_get_boolean(val);
|
||||
options.temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "forceVulkan") == 0)
|
||||
{
|
||||
options.forceVulkan = (bool) json_object_get_boolean(val);
|
||||
options.forceVulkan = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -192,4 +197,3 @@ void ffParseGPUJsonObject(FFinstance* instance, json_object* module)
|
||||
|
||||
ffPrintGPU(instance, &options);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include <yyjson.h>
|
||||
|
||||
#define FF_GPU_MODULE_NAME "GPU"
|
||||
|
||||
void ffPrintGPU(FFinstance* instance, FFGPUOptions* options);
|
||||
void ffInitGPUOptions(FFGPUOptions* options);
|
||||
bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char* value);
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
void ffParseGPUJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
void ffParseGPUJsonObject(FFinstance* instance, yyjson_val* module);
|
||||
|
||||
Reference in New Issue
Block a user