mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
Modules: return bool to indicate whether the detection is succeeded
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
|
||||
#define FF_INITSYSTEM_DISPLAY_NAME "Init System"
|
||||
|
||||
void ffPrintInitSystem(FFInitSystemOptions* options)
|
||||
bool ffPrintInitSystem(FFInitSystemOptions* options)
|
||||
{
|
||||
bool success = false;
|
||||
FFInitSystemResult result = {
|
||||
.name = ffStrbufCreate(),
|
||||
.exe = ffStrbufCreate(),
|
||||
@@ -41,11 +42,14 @@ void ffPrintInitSystem(FFInitSystemOptions* options)
|
||||
FF_FORMAT_ARG(result.pid, "pid"),
|
||||
}));
|
||||
}
|
||||
success = true;
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&result.name);
|
||||
ffStrbufDestroy(&result.exe);
|
||||
ffStrbufDestroy(&result.version);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffParseInitSystemJsonObject(FFInitSystemOptions* options, yyjson_val* module)
|
||||
@@ -66,8 +70,9 @@ void ffGenerateInitSystemJsonConfig(FFInitSystemOptions* options, yyjson_mut_doc
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffGenerateInitSystemJsonResult(FF_MAYBE_UNUSED FFInitSystemOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
bool ffGenerateInitSystemJsonResult(FF_MAYBE_UNUSED FFInitSystemOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool success = false;
|
||||
FFInitSystemResult result = {
|
||||
.name = ffStrbufCreate(),
|
||||
.exe = ffStrbufCreate(),
|
||||
@@ -88,11 +93,13 @@ void ffGenerateInitSystemJsonResult(FF_MAYBE_UNUSED FFInitSystemOptions* options
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "exe", &result.exe);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &result.version);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "pid", result.pid);
|
||||
success = true;
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&result.name);
|
||||
ffStrbufDestroy(&result.exe);
|
||||
ffStrbufDestroy(&result.version);
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffInitInitSystemOptions(FFInitSystemOptions* options)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#define FF_INITSYSTEM_MODULE_NAME "InitSystem"
|
||||
|
||||
void ffPrintInitSystem(FFInitSystemOptions* options);
|
||||
bool ffPrintInitSystem(FFInitSystemOptions* options);
|
||||
void ffInitInitSystemOptions(FFInitSystemOptions* options);
|
||||
void ffDestroyInitSystemOptions(FFInitSystemOptions* options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user