mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-28 15:53:51 +01:00
Global: removes FFlist::elementSize
Improves performance of module Sound and PhysicalMemory
This commit is contained in:
@@ -166,7 +166,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
||||
}
|
||||
|
||||
bool ffPrintBattery(FFBatteryOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBatteryResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBattery(options, &results);
|
||||
|
||||
@@ -233,7 +233,7 @@ void ffGenerateBatteryJsonConfig(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
||||
}
|
||||
|
||||
bool ffGenerateBatteryJsonResult(FFBatteryOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBatteryResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBattery(options, &results);
|
||||
if (error) {
|
||||
|
||||
@@ -56,7 +56,7 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de
|
||||
}
|
||||
|
||||
bool ffPrintBluetooth(FFBluetoothOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY devices = ffListCreate(sizeof(FFBluetoothResult));
|
||||
FF_LIST_AUTO_DESTROY devices = ffListCreate();
|
||||
const char* error = ffDetectBluetooth(options, &devices);
|
||||
|
||||
if (error) {
|
||||
@@ -64,23 +64,14 @@ bool ffPrintBluetooth(FFBluetoothOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFBluetoothResult*));
|
||||
|
||||
FF_LIST_FOR_EACH (FFBluetoothResult, device, devices) {
|
||||
if (!device->connected && !options->showDisconnected) {
|
||||
continue;
|
||||
}
|
||||
|
||||
*(FFBluetoothResult**) ffListAdd(&filtered) = device;
|
||||
}
|
||||
|
||||
if (filtered.length == 0) {
|
||||
if (devices.length == 0) {
|
||||
ffPrintError(FF_BLUETOOTH_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No bluetooth devices found");
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < filtered.length; i++) {
|
||||
uint8_t index = (uint8_t) (filtered.length == 1 ? 0 : i + 1);
|
||||
printDevice(options, *FF_LIST_GET(FFBluetoothResult*, filtered, i), index);
|
||||
uint8_t i = 1;
|
||||
FF_LIST_FOR_EACH (FFBluetoothResult, device, devices) {
|
||||
printDevice(options, device, devices.length == 0 ? 0 : i);
|
||||
++i;
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH (FFBluetoothResult, device, devices) {
|
||||
@@ -121,7 +112,7 @@ void ffGenerateBluetoothJsonConfig(FFBluetoothOptions* options, yyjson_mut_doc*
|
||||
}
|
||||
|
||||
bool ffGenerateBluetoothJsonResult(FFBluetoothOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBluetoothResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBluetooth(options, &results);
|
||||
if (error) {
|
||||
|
||||
@@ -89,7 +89,7 @@ static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadio
|
||||
}
|
||||
|
||||
bool ffPrintBluetoothRadio(FFBluetoothRadioOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY radios = ffListCreate(sizeof(FFBluetoothRadioResult));
|
||||
FF_LIST_AUTO_DESTROY radios = ffListCreate();
|
||||
const char* error = ffDetectBluetoothRadio(&radios);
|
||||
|
||||
if (error) {
|
||||
@@ -140,7 +140,7 @@ void ffGenerateBluetoothRadioJsonConfig(FFBluetoothRadioOptions* options, yyjson
|
||||
}
|
||||
|
||||
bool ffGenerateBluetoothRadioJsonResult(FF_A_UNUSED FFBluetoothRadioOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBluetoothRadioResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBluetoothRadio(&results);
|
||||
if (error) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "modules/brightness/brightness.h"
|
||||
|
||||
bool ffPrintBrightness(FFBrightnessOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBrightness(options, &result);
|
||||
|
||||
@@ -141,7 +141,7 @@ void ffGenerateBrightnessJsonConfig(FFBrightnessOptions* options, yyjson_mut_doc
|
||||
}
|
||||
|
||||
bool ffGenerateBrightnessJsonResult(FF_A_UNUSED FFBrightnessOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBrightness(options, &result);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ static void printBtrfs(FFBtrfsOptions* options, FFBtrfsResult* result, uint8_t i
|
||||
}
|
||||
|
||||
bool ffPrintBtrfs(FFBtrfsOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBtrfsResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBtrfs(&results);
|
||||
|
||||
@@ -147,7 +147,7 @@ void ffGenerateBtrfsJsonConfig(FFBtrfsOptions* options, yyjson_mut_doc* doc, yyj
|
||||
}
|
||||
|
||||
bool ffGenerateBtrfsJsonResult(FF_A_UNUSED FFBtrfsOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBtrfsResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectBtrfs(&results);
|
||||
if (error) {
|
||||
|
||||
@@ -33,7 +33,7 @@ static void printDevice(FFCameraOptions* options, const FFCameraResult* device,
|
||||
}
|
||||
|
||||
bool ffPrintCamera(FFCameraOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFCameraResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectCamera(&result);
|
||||
|
||||
if (error) {
|
||||
@@ -77,7 +77,7 @@ void ffGenerateCameraJsonConfig(FFCameraOptions* options, yyjson_mut_doc* doc, y
|
||||
}
|
||||
|
||||
bool ffGenerateCameraJsonResult(FF_A_UNUSED FFCameraOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFCameraResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectCamera(&result);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -104,10 +104,10 @@ bool ffPrintCPUCache(FFCPUCacheOptions* options) {
|
||||
bool success = false;
|
||||
FFCPUCacheResult result = {
|
||||
.caches = {
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -161,10 +161,10 @@ bool ffGenerateCPUCacheJsonResult(FF_A_UNUSED FFCPUCacheOptions* options, yyjson
|
||||
bool success = false;
|
||||
FFCPUCacheResult result = {
|
||||
.caches = {
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(sizeof(FFCPUCache)),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
ffListCreate(),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define FF_CPUUSAGE_DISPLAY_NAME "CPU Usage"
|
||||
|
||||
bool ffPrintCPUUsage(FFCPUUsageOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY percentages = ffListCreate(sizeof(double));
|
||||
FF_LIST_AUTO_DESTROY percentages = ffListCreate();
|
||||
const char* error = ffGetCpuUsageResult(options, &percentages);
|
||||
|
||||
if (error) {
|
||||
@@ -154,7 +154,7 @@ void ffGenerateCPUUsageJsonConfig(FFCPUUsageOptions* options, yyjson_mut_doc* do
|
||||
}
|
||||
|
||||
bool ffGenerateCPUUsageJsonResult(FFCPUUsageOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY percentages = ffListCreate(sizeof(double));
|
||||
FF_LIST_AUTO_DESTROY percentages = ffListCreate();
|
||||
const char* error = ffGetCpuUsageResult(options, &percentages);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -183,7 +183,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
|
||||
}
|
||||
|
||||
bool ffPrintDisk(FFDiskOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY disks = ffListCreate(sizeof(FFDisk));
|
||||
FF_LIST_AUTO_DESTROY disks = ffListCreate();
|
||||
const char* error = ffDetectDisks(options, &disks);
|
||||
|
||||
if (error) {
|
||||
@@ -358,7 +358,7 @@ void ffGenerateDiskJsonConfig(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
}
|
||||
|
||||
bool ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY disks = ffListCreate(sizeof(FFDisk));
|
||||
FF_LIST_AUTO_DESTROY disks = ffListCreate();
|
||||
const char* error = ffDetectDisks(options, &disks);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -26,7 +26,7 @@ static void formatKey(const FFDiskIOOptions* options, FFDiskIOResult* dev, uint3
|
||||
}
|
||||
|
||||
bool ffPrintDiskIO(FFDiskIOOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFDiskIOResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectDiskIO(&result, options);
|
||||
|
||||
if (error) {
|
||||
@@ -34,7 +34,7 @@ bool ffPrintDiskIO(FFDiskIOOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ffListSort(&result, (const void*) sortDevices);
|
||||
ffListSort(&result, sizeof(FFDiskIOResult), (const void*) sortDevices);
|
||||
|
||||
uint32_t index = 0;
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
@@ -131,7 +131,7 @@ void ffGenerateDiskIOJsonConfig(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
||||
}
|
||||
|
||||
bool ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFDiskIOResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectDiskIO(&result, options);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -24,7 +24,7 @@ bool ffPrintDisplay(FFDisplayOptions* options) {
|
||||
}
|
||||
|
||||
if (options->order != FF_DISPLAY_ORDER_NONE) {
|
||||
ffListSort((FFlist*) &dsResult->displays, (void*) (options->order == FF_DISPLAY_ORDER_ASC ? sortByNameAsc : sortByNameDesc));
|
||||
ffListSort((FFlist*) &dsResult->displays, sizeof(FFDisplayResult), (void*) (options->order == FF_DISPLAY_ORDER_ASC ? sortByNameAsc : sortByNameDesc));
|
||||
}
|
||||
|
||||
if (options->compactType != FF_DISPLAY_COMPACT_TYPE_NONE) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "modules/dns/dns.h"
|
||||
|
||||
bool ffPrintDNS(FFDNSOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFstrbuf));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectDNS(options, &result);
|
||||
|
||||
@@ -101,7 +101,7 @@ void ffGenerateDNSJsonConfig(FFDNSOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
}
|
||||
|
||||
bool ffGenerateDNSJsonResult(FFDNSOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFstrbuf));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectDNS(options, &result);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device
|
||||
}
|
||||
|
||||
bool ffPrintGamepad(FFGamepadOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFGamepadDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectGamepad(&result);
|
||||
|
||||
@@ -63,7 +63,7 @@ bool ffPrintGamepad(FFGamepadOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFGamepadDevice*));
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate();
|
||||
FF_LIST_FOR_EACH (FFGamepadDevice, device, result) {
|
||||
bool ignored = false;
|
||||
FF_LIST_FOR_EACH (FFstrbuf, ignore, options->ignores) {
|
||||
@@ -73,7 +73,7 @@ bool ffPrintGamepad(FFGamepadOptions* options) {
|
||||
}
|
||||
}
|
||||
if (!ignored) {
|
||||
FFGamepadDevice** ptr = ffListAdd(&filtered);
|
||||
FFGamepadDevice** ptr = FF_LIST_ADD(FFGamepadDevice*, filtered);
|
||||
*ptr = device;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module) {
|
||||
size_t eidx, emax;
|
||||
yyjson_arr_foreach (val, eidx, emax, elem) {
|
||||
if (yyjson_is_str(elem)) {
|
||||
FFstrbuf* strbuf = ffListAdd(&options->ignores);
|
||||
FFstrbuf* strbuf = FF_LIST_ADD(FFstrbuf, options->ignores);
|
||||
ffStrbufInitJsonVal(strbuf, elem);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void ffGenerateGamepadJsonConfig(FFGamepadOptions* options, yyjson_mut_doc* doc,
|
||||
}
|
||||
|
||||
bool ffGenerateGamepadJsonResult(FF_A_UNUSED FFGamepadOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFGamepadDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectGamepad(&result);
|
||||
|
||||
@@ -175,7 +175,7 @@ bool ffGenerateGamepadJsonResult(FF_A_UNUSED FFGamepadOptions* options, yyjson_m
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffListInit(&options->ignores, sizeof(FFstrbuf));
|
||||
ffListInit(&options->ignores);
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
}
|
||||
|
||||
|
||||
@@ -165,15 +165,14 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
}
|
||||
|
||||
bool ffPrintGPU(FFGPUOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY gpus = ffListCreate(sizeof(FFGPUResult));
|
||||
FF_LIST_AUTO_DESTROY gpus = ffListCreate();
|
||||
const char* error = ffDetectGPU(options, &gpus);
|
||||
if (error) {
|
||||
ffPrintError(FF_GPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY selectedGPUs;
|
||||
ffListInitA(&selectedGPUs, sizeof(const FFGPUResult*), gpus.length);
|
||||
FF_LIST_AUTO_DESTROY selectedGPUs = ffListCreateA(sizeof(const FFGPUResult*), gpus.length);
|
||||
|
||||
FF_LIST_FOR_EACH (FFGPUResult, gpu, gpus) {
|
||||
if (gpu->type == FF_GPU_TYPE_UNKNOWN && options->hideType == FF_GPU_TYPE_UNKNOWN) {
|
||||
@@ -188,11 +187,13 @@ bool ffPrintGPU(FFGPUOptions* options) {
|
||||
continue;
|
||||
}
|
||||
|
||||
*(const FFGPUResult**) ffListAdd(&selectedGPUs) = gpu;
|
||||
*FF_LIST_ADD(const FFGPUResult*, selectedGPUs) = gpu;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < selectedGPUs.length; i++) {
|
||||
printGPUResult(options, selectedGPUs.length == 1 ? 0 : (uint8_t) (i + 1), *FF_LIST_GET(const FFGPUResult*, selectedGPUs, i));
|
||||
uint32_t i = 0;
|
||||
FF_LIST_FOR_EACH (const FFGPUResult*, pgpu, selectedGPUs) {
|
||||
printGPUResult(options, selectedGPUs.length == 1 ? 0 : (uint8_t) (i + 1), *pgpu);
|
||||
++i;
|
||||
}
|
||||
|
||||
if (selectedGPUs.length == 0) {
|
||||
@@ -318,7 +319,7 @@ void ffGenerateGPUJsonConfig(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
}
|
||||
|
||||
bool ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY gpus = ffListCreate(sizeof(FFGPUResult));
|
||||
FF_LIST_AUTO_DESTROY gpus = ffListCreate();
|
||||
const char* error = ffDetectGPU(options, &gpus);
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
|
||||
@@ -18,7 +18,7 @@ static void printDevice(FFKeyboardOptions* options, const FFKeyboardDevice* devi
|
||||
}
|
||||
|
||||
bool ffPrintKeyboard(FFKeyboardOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFKeyboardDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectKeyboard(&result);
|
||||
|
||||
@@ -32,7 +32,7 @@ bool ffPrintKeyboard(FFKeyboardOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFKeyboardDevice*));
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate();
|
||||
FF_LIST_FOR_EACH (FFKeyboardDevice, device, result) {
|
||||
bool ignored = false;
|
||||
FF_LIST_FOR_EACH (FFstrbuf, ignore, options->ignores) {
|
||||
@@ -42,7 +42,7 @@ bool ffPrintKeyboard(FFKeyboardOptions* options) {
|
||||
}
|
||||
}
|
||||
if (!ignored) {
|
||||
FFKeyboardDevice** ptr = ffListAdd(&filtered);
|
||||
FFKeyboardDevice** ptr = FF_LIST_ADD(FFKeyboardDevice*, filtered);
|
||||
*ptr = device;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void ffParseKeyboardJsonObject(FFKeyboardOptions* options, yyjson_val* module) {
|
||||
size_t eidx, emax;
|
||||
yyjson_arr_foreach (val, eidx, emax, elem) {
|
||||
if (yyjson_is_str(elem)) {
|
||||
FFstrbuf* strbuf = ffListAdd(&options->ignores);
|
||||
FFstrbuf* strbuf = FF_LIST_ADD(FFstrbuf, options->ignores);
|
||||
ffStrbufInitJsonVal(strbuf, elem);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void ffGenerateKeyboardJsonConfig(FFKeyboardOptions* options, yyjson_mut_doc* do
|
||||
}
|
||||
|
||||
bool ffGenerateKeyboardJsonResult(FF_A_UNUSED FFKeyboardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFKeyboardDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectKeyboard(&result);
|
||||
|
||||
@@ -136,7 +136,7 @@ bool ffGenerateKeyboardJsonResult(FF_A_UNUSED FFKeyboardOptions* options, yyjson
|
||||
void ffInitKeyboardOptions(FFKeyboardOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffListInit(&options->ignores, sizeof(FFstrbuf));
|
||||
ffListInit(&options->ignores);
|
||||
}
|
||||
|
||||
void ffDestroyKeyboardOptions(FFKeyboardOptions* options) {
|
||||
|
||||
@@ -95,7 +95,7 @@ static void printIp(FFLocalIpResult* ip, bool markDefaultRoute, FFstrbuf* buffer
|
||||
}
|
||||
|
||||
bool ffPrintLocalIp(FFLocalIpOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFLocalIpResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectLocalIps(options, &results);
|
||||
|
||||
@@ -109,7 +109,7 @@ bool ffPrintLocalIp(FFLocalIpOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ffListSort(&results, (const void*) sortIps);
|
||||
ffListSort(&results, sizeof(FFLocalIpResult), (const void*) sortIps);
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
|
||||
@@ -351,7 +351,7 @@ void ffGenerateLocalIpJsonConfig(FFLocalIpOptions* options, yyjson_mut_doc* doc,
|
||||
}
|
||||
|
||||
bool ffGenerateLocalIpJsonResult(FF_A_UNUSED FFLocalIpOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFLocalIpResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectLocalIps(options, &results);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ static void printDevice(FFMouseOptions* options, const FFMouseDevice* device, ui
|
||||
}
|
||||
|
||||
bool ffPrintMouse(FFMouseOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFMouseDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectMouse(&result);
|
||||
|
||||
@@ -32,7 +32,7 @@ bool ffPrintMouse(FFMouseOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFMouseDevice*));
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate();
|
||||
FF_LIST_FOR_EACH (FFMouseDevice, device, result) {
|
||||
bool ignored = false;
|
||||
FF_LIST_FOR_EACH (FFstrbuf, ignore, options->ignores) {
|
||||
@@ -42,7 +42,7 @@ bool ffPrintMouse(FFMouseOptions* options) {
|
||||
}
|
||||
}
|
||||
if (!ignored) {
|
||||
FFMouseDevice** ptr = ffListAdd(&filtered);
|
||||
FFMouseDevice** ptr = FF_LIST_ADD(FFMouseDevice*, filtered);
|
||||
*ptr = device;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void ffParseMouseJsonObject(FFMouseOptions* options, yyjson_val* module) {
|
||||
size_t eidx, emax;
|
||||
yyjson_arr_foreach (val, eidx, emax, elem) {
|
||||
if (yyjson_is_str(elem)) {
|
||||
FFstrbuf* strbuf = ffListAdd(&options->ignores);
|
||||
FFstrbuf* strbuf = FF_LIST_ADD(FFstrbuf, options->ignores);
|
||||
ffStrbufInitJsonVal(strbuf, elem);
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void ffGenerateMouseJsonConfig(FFMouseOptions* options, yyjson_mut_doc* doc, yyj
|
||||
}
|
||||
|
||||
bool ffGenerateMouseJsonResult(FF_A_UNUSED FFMouseOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFMouseDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectMouse(&result);
|
||||
|
||||
@@ -139,7 +139,7 @@ bool ffGenerateMouseJsonResult(FF_A_UNUSED FFMouseOptions* options, yyjson_mut_d
|
||||
void ffInitMouseOptions(FFMouseOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffListInit(&options->ignores, sizeof(FFstrbuf));
|
||||
ffListInit(&options->ignores);
|
||||
}
|
||||
|
||||
void ffDestroyMouseOptions(FFMouseOptions* options) {
|
||||
|
||||
@@ -29,7 +29,7 @@ static void formatKey(const FFNetIOOptions* options, FFNetIOResult* inf, uint32_
|
||||
}
|
||||
|
||||
bool ffPrintNetIO(FFNetIOOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFNetIOResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectNetIO(&result, options);
|
||||
|
||||
if (error) {
|
||||
@@ -37,7 +37,7 @@ bool ffPrintNetIO(FFNetIOOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ffListSort(&result, (const void*) sortInfs);
|
||||
ffListSort(&result, sizeof(FFNetIOResult), (const void*) sortInfs);
|
||||
|
||||
uint32_t index = 0;
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
@@ -148,7 +148,7 @@ void ffGenerateNetIOJsonConfig(FFNetIOOptions* options, yyjson_mut_doc* doc, yyj
|
||||
}
|
||||
|
||||
bool ffGenerateNetIOJsonResult(FFNetIOOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFNetIOResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectNetIO(&result, options);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -26,7 +26,7 @@ static void formatKey(const FFPhysicalDiskOptions* options, FFPhysicalDiskResult
|
||||
}
|
||||
|
||||
bool ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFPhysicalDiskResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectPhysicalDisk(&result, options);
|
||||
|
||||
if (error) {
|
||||
@@ -34,7 +34,7 @@ bool ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ffListSort(&result, (const void*) sortDevices);
|
||||
ffListSort(&result, sizeof(FFPhysicalDiskResult), (const void*) sortDevices);
|
||||
|
||||
uint32_t index = 0;
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
@@ -181,7 +181,7 @@ void ffGeneratePhysicalDiskJsonConfig(FFPhysicalDiskOptions* options, yyjson_mut
|
||||
}
|
||||
|
||||
bool ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFPhysicalDiskResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectPhysicalDisk(&result, options);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#define FF_PHYSICALMEMORY_DISPLAY_NAME "Physical Memory"
|
||||
|
||||
bool ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFPhysicalMemoryResult));
|
||||
const char* error = ffDetectPhysicalMemory(&result);
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectPhysicalMemory(options, &result);
|
||||
|
||||
if (error) {
|
||||
ffPrintError(FF_PHYSICALMEMORY_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||
@@ -16,35 +16,21 @@ bool ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) {
|
||||
}
|
||||
|
||||
if (result.length == 0) {
|
||||
ffPrintError(FF_PHYSICALMEMORY_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No physical memory detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFPhysicalMemoryResult*));
|
||||
FF_LIST_FOR_EACH (FFPhysicalMemoryResult, device, result) {
|
||||
if (!options->showEmptySlots && !device->installed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
*(FFPhysicalMemoryResult**) ffListAdd(&filtered) = device;
|
||||
}
|
||||
|
||||
if (filtered.length == 0) {
|
||||
ffPrintError(FF_PHYSICALMEMORY_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No installed physical memory detected");
|
||||
ffPrintError(FF_PHYSICALMEMORY_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No physical memory devices detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY prettySize = ffStrbufCreate();
|
||||
|
||||
for (uint32_t i = 0; i < filtered.length; ++i) {
|
||||
FFPhysicalMemoryResult* device = *FF_LIST_GET(FFPhysicalMemoryResult*, filtered, i);
|
||||
uint32_t i = 0;
|
||||
FF_LIST_FOR_EACH (FFPhysicalMemoryResult, device, result) {
|
||||
ffStrbufClear(&prettySize);
|
||||
if (device->installed) {
|
||||
ffSizeAppendNum(device->size, &prettySize);
|
||||
}
|
||||
|
||||
if (options->moduleArgs.outputFormat.length == 0) {
|
||||
ffPrintLogoAndKey(FF_PHYSICALMEMORY_DISPLAY_NAME, filtered.length == 1 ? 0 : (uint8_t) (i + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffPrintLogoAndKey(FF_PHYSICALMEMORY_DISPLAY_NAME, result.length == 1 ? 0 : (uint8_t) (i + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
|
||||
if (device->installed) {
|
||||
fputs(prettySize.chars, stdout);
|
||||
@@ -88,6 +74,8 @@ bool ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) {
|
||||
FF_ARG(device->installed, "is-installed"),
|
||||
}));
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH (FFPhysicalMemoryResult, device, result) {
|
||||
@@ -124,9 +112,9 @@ void ffGeneratePhysicalMemoryJsonConfig(FFPhysicalMemoryOptions* options, yyjson
|
||||
yyjson_mut_obj_add_bool(doc, module, "showEmptySlots", options->showEmptySlots);
|
||||
}
|
||||
|
||||
bool ffGeneratePhysicalMemoryJsonResult(FF_A_UNUSED FFPhysicalMemoryOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFPhysicalMemoryResult));
|
||||
const char* error = ffDetectPhysicalMemory(&result);
|
||||
bool ffGeneratePhysicalMemoryJsonResult(FFPhysicalMemoryOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectPhysicalMemory(options, &result);
|
||||
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
||||
|
||||
bool ffPrintPowerAdapter(FFPowerAdapterOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFPowerAdapterResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectPowerAdapter(&results);
|
||||
|
||||
@@ -70,7 +70,7 @@ void ffParsePowerAdapterJsonObject(FFPowerAdapterOptions* options, yyjson_val* m
|
||||
}
|
||||
|
||||
bool ffGeneratePowerAdapterJsonResult(FF_A_UNUSED FFPowerAdapterOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFPowerAdapterResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectPowerAdapter(&results);
|
||||
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef enum FF_A_PACKED FFSoundType {
|
||||
FF_SOUND_TYPE_MAIN,
|
||||
FF_SOUND_TYPE_ACTIVE,
|
||||
FF_SOUND_TYPE_ALL,
|
||||
FF_SOUND_TYPE_NONE = 0,
|
||||
FF_SOUND_TYPE_MAIN = 1 << 0,
|
||||
FF_SOUND_TYPE_ACTIVE = 1 << 1,
|
||||
} FFSoundType;
|
||||
|
||||
typedef struct FFSoundOptions {
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
// Reports matched device only, otherwise reports all devices
|
||||
// NOTE: for FF_SOUND_TYPE_NONE, reports all devices
|
||||
FFSoundType soundType;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFSoundOptions;
|
||||
|
||||
+16
-41
@@ -65,50 +65,25 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui
|
||||
|
||||
bool ffPrintSound(FFSoundOptions* options) {
|
||||
bool success = false;
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSoundDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectSound(&result);
|
||||
const char* error = ffDetectSound(options, &result);
|
||||
|
||||
if (error) {
|
||||
ffPrintError(FF_SOUND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||
goto exit;
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFSoundDevice*));
|
||||
|
||||
FF_LIST_FOR_EACH (FFSoundDevice, device, result) {
|
||||
switch (options->soundType) {
|
||||
case FF_SOUND_TYPE_MAIN:
|
||||
if (!device->main) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FF_SOUND_TYPE_ACTIVE:
|
||||
if (!device->active) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FF_SOUND_TYPE_ALL:
|
||||
break;
|
||||
}
|
||||
|
||||
*(FFSoundDevice**) ffListAdd(&filtered) = device;
|
||||
}
|
||||
|
||||
if (filtered.length == 0) {
|
||||
ffPrintError(FF_SOUND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No active sound devices found");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
uint8_t index = 1;
|
||||
FF_LIST_FOR_EACH (FFSoundDevice*, device, filtered) {
|
||||
printDevice(options, *device, filtered.length == 1 ? 0 : index++);
|
||||
}
|
||||
if (result.length == 0) {
|
||||
ffPrintError(FF_SOUND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No matched sound devices found");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t index = 1;
|
||||
FF_LIST_FOR_EACH (FFSoundDevice, device, result) {
|
||||
printDevice(options, device, result.length == 1 ? 0 : index++);
|
||||
}
|
||||
success = true;
|
||||
|
||||
exit:
|
||||
FF_LIST_FOR_EACH (FFSoundDevice, device, result) {
|
||||
ffStrbufDestroy(&device->identifier);
|
||||
ffStrbufDestroy(&device->name);
|
||||
@@ -131,7 +106,7 @@ void ffParseSoundJsonObject(FFSoundOptions* options, yyjson_val* module) {
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
{ "main", FF_SOUND_TYPE_MAIN },
|
||||
{ "active", FF_SOUND_TYPE_ACTIVE },
|
||||
{ "all", FF_SOUND_TYPE_ALL },
|
||||
{ "all", FF_SOUND_TYPE_NONE }, // Don't filter devices
|
||||
{},
|
||||
});
|
||||
if (error) {
|
||||
@@ -160,7 +135,7 @@ void ffGenerateSoundJsonConfig(FFSoundOptions* options, yyjson_mut_doc* doc, yyj
|
||||
case FF_SOUND_TYPE_ACTIVE:
|
||||
yyjson_mut_obj_add_str(doc, module, "soundType", "active");
|
||||
break;
|
||||
case FF_SOUND_TYPE_ALL:
|
||||
case FF_SOUND_TYPE_NONE:
|
||||
yyjson_mut_obj_add_str(doc, module, "soundType", "all");
|
||||
break;
|
||||
}
|
||||
@@ -168,9 +143,9 @@ void ffGenerateSoundJsonConfig(FFSoundOptions* options, yyjson_mut_doc* doc, yyj
|
||||
ffPercentGenerateJsonConfig(doc, module, options->percent);
|
||||
}
|
||||
|
||||
bool ffGenerateSoundJsonResult(FF_A_UNUSED FFSoundOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSoundDevice));
|
||||
const char* error = ffDetectSound(&result);
|
||||
bool ffGenerateSoundJsonResult(FFSoundOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectSound(options, &result);
|
||||
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
|
||||
@@ -86,7 +86,7 @@ void printSwap(FFSwapOptions* options, uint8_t index, uint32_t totalCount, FFSwa
|
||||
}
|
||||
|
||||
bool ffPrintSwap(FFSwapOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSwapResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectSwap(&result);
|
||||
|
||||
if (error) {
|
||||
@@ -148,7 +148,7 @@ void ffGenerateSwapJsonConfig(FFSwapOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
}
|
||||
|
||||
bool ffGenerateSwapJsonResult(FF_A_UNUSED FFSwapOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSwapResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectSwap(&result);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma GCC diagnostic ignored "-Wformat" // warning: unknown conversion type character 'F' in format
|
||||
|
||||
bool ffPrintUsers(FFUsersOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY users = ffListCreate(sizeof(FFUserResult));
|
||||
FF_LIST_AUTO_DESTROY users = ffListCreate();
|
||||
|
||||
const char* error = ffDetectUsers(options, &users);
|
||||
|
||||
@@ -134,7 +134,7 @@ void ffGenerateUsersJsonConfig(FFUsersOptions* options, yyjson_mut_doc* doc, yyj
|
||||
}
|
||||
|
||||
bool ffGenerateUsersJsonResult(FFUsersOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFUserResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectUsers(options, &results);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "modules/wifi/wifi.h"
|
||||
|
||||
bool ffPrintWifi(FFWifiOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFWifiResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
|
||||
const char* error = ffDetectWifi(&result);
|
||||
if (error) {
|
||||
@@ -150,7 +150,7 @@ void ffGenerateWifiJsonConfig(FFWifiOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
}
|
||||
|
||||
bool ffGenerateWifiJsonResult(FF_A_UNUSED FFWifiOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFWifiResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate();
|
||||
const char* error = ffDetectWifi(&result);
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
|
||||
@@ -100,7 +100,7 @@ static void printZpool(FFZpoolOptions* options, FFZpoolResult* result, uint8_t i
|
||||
}
|
||||
|
||||
bool ffPrintZpool(FFZpoolOptions* options) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFZpoolResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectZpool(&results);
|
||||
|
||||
@@ -149,7 +149,7 @@ void ffGenerateZpoolJsonConfig(FFZpoolOptions* options, yyjson_mut_doc* doc, yyj
|
||||
}
|
||||
|
||||
bool ffGenerateZpoolJsonResult(FF_A_UNUSED FFZpoolOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFZpoolResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate();
|
||||
|
||||
const char* error = ffDetectZpool(&results);
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user