From a5ee51e1561437df9b57a32b2679813160044c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 28 Aug 2023 13:53:09 +0800 Subject: [PATCH] Global: use FF_LIST_AUTO_DESTROY --- src/modules/battery/battery.c | 5 +---- src/modules/poweradapter/poweradapter.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index 4f239650a..ee4bd5af7 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -76,8 +76,7 @@ static void printBattery(FFBatteryOptions* options, BatteryResult* result, uint8 void ffPrintBattery(FFBatteryOptions* options) { - FFlist results; - ffListInitA(&results, sizeof(BatteryResult), 0); + FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(BatteryResult)); const char* error = ffDetectBattery(options, &results); @@ -100,8 +99,6 @@ void ffPrintBattery(FFBatteryOptions* options) if(results.length == 0) ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, "No batteries found"); } - - ffListDestroy(&results); } void ffInitBatteryOptions(FFBatteryOptions* options) diff --git a/src/modules/poweradapter/poweradapter.c b/src/modules/poweradapter/poweradapter.c index 7fcd772af..efee4a7f3 100644 --- a/src/modules/poweradapter/poweradapter.c +++ b/src/modules/poweradapter/poweradapter.c @@ -9,8 +9,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options) { - FFlist results; - ffListInit(&results, sizeof(PowerAdapterResult)); + FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(PowerAdapterResult)); const char* error = ffDetectPowerAdapterImpl(&results); @@ -59,8 +58,6 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options) ffStrbufDestroy(&result->name); } } - - ffListDestroy(&results); } void ffInitPowerAdapterOptions(FFPowerAdapterOptions* options)