mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 21:24:43 +01:00
Modules: return bool to indicate whether the detection is succeeded
This commit is contained in:
@@ -30,7 +30,7 @@ static void formatKey(const FFDiskIOOptions* options, FFDiskIOResult* dev, uint3
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintDiskIO(FFDiskIOOptions* options)
|
||||
bool ffPrintDiskIO(FFDiskIOOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFDiskIOResult));
|
||||
const char* error = ffDetectDiskIO(&result, options);
|
||||
@@ -38,7 +38,7 @@ void ffPrintDiskIO(FFDiskIOOptions* options)
|
||||
if(error)
|
||||
{
|
||||
ffPrintError(FF_DISKIO_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
ffListSort(&result, (const void*) sortDevices);
|
||||
@@ -93,6 +93,8 @@ void ffPrintDiskIO(FFDiskIOOptions* options)
|
||||
ffStrbufDestroy(&dev->name);
|
||||
ffStrbufDestroy(&dev->devPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffParseDiskIOJsonObject(FFDiskIOOptions* options, yyjson_val* module)
|
||||
@@ -137,7 +139,7 @@ void ffGenerateDiskIOJsonConfig(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
||||
yyjson_mut_obj_add_uint(doc, module, "waitTime", options->waitTime);
|
||||
}
|
||||
|
||||
void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
bool ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFDiskIOResult));
|
||||
const char* error = ffDetectDiskIO(&result, options);
|
||||
@@ -145,7 +147,7 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
||||
if(error)
|
||||
{
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||
@@ -165,6 +167,8 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
||||
ffStrbufDestroy(&dev->name);
|
||||
ffStrbufDestroy(&dev->devPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
void ffPrepareDiskIO(FFDiskIOOptions* options);
|
||||
|
||||
void ffPrintDiskIO(FFDiskIOOptions* options);
|
||||
bool ffPrintDiskIO(FFDiskIOOptions* options);
|
||||
void ffInitDiskIOOptions(FFDiskIOOptions* options);
|
||||
void ffDestroyDiskIOOptions(FFDiskIOOptions* options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user