mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Global: major FFlist related code refactor
This commit is contained in:
@@ -37,8 +37,7 @@ void ffPrintBluetooth(FFinstance* instance, FFBluetoothOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
FFlist filtered;
|
||||
ffListInit(&filtered, sizeof(FFBluetoothDevice*));
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFBluetoothDevice*));
|
||||
|
||||
FF_LIST_FOR_EACH(FFBluetoothDevice, device, bluetooth->devices)
|
||||
{
|
||||
@@ -59,8 +58,6 @@ void ffPrintBluetooth(FFinstance* instance, FFBluetoothOptions* options)
|
||||
uint8_t index = (uint8_t) (filtered.length == 1 ? 0 : i + 1);
|
||||
printDevice(instance, options, *(FFBluetoothDevice**)ffListGet(&filtered, i), index);
|
||||
}
|
||||
|
||||
ffListDestroy(&filtered);
|
||||
}
|
||||
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
void ffPrintBrightness(FFinstance* instance, FFBrightnessOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result;
|
||||
ffListInit(&result, sizeof(FFBrightnessResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
|
||||
|
||||
const char* error = ffDetectBrightness(&result);
|
||||
|
||||
if(error)
|
||||
|
||||
@@ -22,8 +22,8 @@ static void printDevice(FFinstance* instance, FFGamepadOptions* options, const F
|
||||
|
||||
void ffPrintGamepad(FFinstance* instance, FFGamepadOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result;
|
||||
ffListInit(&result, sizeof(FFGamepadDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFGamepadDevice));
|
||||
|
||||
const char* error = ffDetectGamepad(instance, &result);
|
||||
|
||||
if(error)
|
||||
|
||||
@@ -55,8 +55,7 @@ static void printIp(FFLocalIpResult* ip)
|
||||
|
||||
void ffPrintLocalIp(FFinstance* instance, FFLocalIpOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY results;
|
||||
ffListInit(&results, sizeof(FFLocalIpResult));
|
||||
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFLocalIpResult));
|
||||
|
||||
const char* error = ffDetectLocalIps(options, &results);
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ static void printDevice(FFinstance* instance, FFSoundOptions* options, const FFS
|
||||
|
||||
void ffPrintSound(FFinstance* instance, FFSoundOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result;
|
||||
ffListInit(&result, sizeof(FFSoundDevice));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSoundDevice));
|
||||
|
||||
const char* error = ffDetectSound(instance, &result);
|
||||
|
||||
if(error)
|
||||
@@ -47,8 +47,7 @@ void ffPrintSound(FFinstance* instance, FFSoundOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
FF_LIST_AUTO_DESTROY filtered;
|
||||
ffListInit(&filtered, sizeof(FFSoundDevice*));
|
||||
FF_LIST_AUTO_DESTROY filtered = ffListCreate(sizeof(FFSoundDevice*));
|
||||
|
||||
FF_LIST_FOR_EACH(FFSoundDevice, device, result)
|
||||
{
|
||||
|
||||
+1
-2
@@ -7,8 +7,7 @@
|
||||
|
||||
void ffPrintUsers(FFinstance* instance)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY users;
|
||||
ffListInit(&users, sizeof(FFstrbuf));
|
||||
FF_LIST_AUTO_DESTROY users = ffListCreate(sizeof(FFstrbuf));
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY error = ffStrbufCreate();
|
||||
|
||||
|
||||
+1
-2
@@ -7,8 +7,7 @@
|
||||
|
||||
void ffPrintWifi(FFinstance* instance)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY result;
|
||||
ffListInit(&result, sizeof(FFWifiResult));
|
||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFWifiResult));
|
||||
|
||||
const char* error = ffDetectWifi(instance, &result);
|
||||
if(error)
|
||||
|
||||
Reference in New Issue
Block a user