diff --git a/src/modules/gamepad/gamepad.c b/src/modules/gamepad/gamepad.c index ce0c6079a..327d73b15 100644 --- a/src/modules/gamepad/gamepad.c +++ b/src/modules/gamepad/gamepad.c @@ -87,26 +87,29 @@ bool ffPrintGamepad(FFGamepadOptions* options) } } + bool ret = true; if(!filtered.length) { ffPrintError(FF_GAMEPAD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "All devices are ignored"); - return false; + ret = false; } - - uint8_t index = 0; - FF_LIST_FOR_EACH(FFGamepadDevice*, pdevice, filtered) + else { - FFGamepadDevice* device = *pdevice; - printDevice(options, device, filtered.length > 1 ? ++index : 0); + uint8_t index = 0; + FF_LIST_FOR_EACH(FFGamepadDevice*, pdevice, filtered) + { + FFGamepadDevice* device = *pdevice; + printDevice(options, device, filtered.length > 1 ? ++index : 0); + } + + FF_LIST_FOR_EACH(FFGamepadDevice, device, result) + { + ffStrbufDestroy(&device->serial); + ffStrbufDestroy(&device->name); + } } - FF_LIST_FOR_EACH(FFGamepadDevice, device, result) - { - ffStrbufDestroy(&device->serial); - ffStrbufDestroy(&device->name); - } - - return true; + return ret; } void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module) diff --git a/src/modules/keyboard/keyboard.c b/src/modules/keyboard/keyboard.c index 57f27ad43..b33c4ff4a 100644 --- a/src/modules/keyboard/keyboard.c +++ b/src/modules/keyboard/keyboard.c @@ -58,22 +58,25 @@ bool ffPrintKeyboard(FFKeyboardOptions* options) } } + bool ret = true; if(!filtered.length) { ffPrintError(FF_KEYBOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "All devices are ignored"); - return false; + ret = false; } - - uint8_t index = 0; - FF_LIST_FOR_EACH(FFKeyboardDevice*, pdevice, filtered) + else { - FFKeyboardDevice* device = *pdevice; - printDevice(options, device, filtered.length > 1 ? ++index : 0); - ffStrbufDestroy(&device->serial); - ffStrbufDestroy(&device->name); + uint8_t index = 0; + FF_LIST_FOR_EACH(FFKeyboardDevice*, pdevice, filtered) + { + FFKeyboardDevice* device = *pdevice; + printDevice(options, device, filtered.length > 1 ? ++index : 0); + ffStrbufDestroy(&device->serial); + ffStrbufDestroy(&device->name); + } } - return true; + return ret; } void ffParseKeyboardJsonObject(FFKeyboardOptions* options, yyjson_val* module) diff --git a/src/modules/mouse/mouse.c b/src/modules/mouse/mouse.c index 9789399fe..a0e3ef69a 100644 --- a/src/modules/mouse/mouse.c +++ b/src/modules/mouse/mouse.c @@ -58,22 +58,29 @@ bool ffPrintMouse(FFMouseOptions* options) } } + bool ret = true; if(!filtered.length) { ffPrintError(FF_MOUSE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "All devices are ignored"); - return false; + ret = false; + } + else + { + uint8_t index = 0; + FF_LIST_FOR_EACH(FFMouseDevice*, pdevice, filtered) + { + FFMouseDevice* device = *pdevice; + printDevice(options, device, filtered.length > 1 ? ++index : 0); + } } - uint8_t index = 0; - FF_LIST_FOR_EACH(FFMouseDevice*, pdevice, filtered) + FF_LIST_FOR_EACH(FFMouseDevice, device, result) { - FFMouseDevice* device = *pdevice; - printDevice(options, device, filtered.length > 1 ? ++index : 0); ffStrbufDestroy(&device->serial); ffStrbufDestroy(&device->name); } - return true; + return ret; } void ffParseMouseJsonObject(FFMouseOptions* options, yyjson_val* module)