mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Global: prefers gnu::cleanup
This commit is contained in:
@@ -74,9 +74,11 @@ const char* ffDetectBluetoothRadio(FFlist* devices /* FFBluetoothRadioResult */)
|
||||
}
|
||||
|
||||
do {
|
||||
FF_AUTO_CLOSE_FD HANDLE hCurrent = hRadio;
|
||||
|
||||
BTH_LOCAL_RADIO_INFO blri;
|
||||
DWORD returned;
|
||||
if (!DeviceIoControl(hRadio, IOCTL_BTH_GET_LOCAL_INFO, nullptr, 0, &blri, sizeof(blri), &returned, nullptr)) {
|
||||
if (!DeviceIoControl(hCurrent, IOCTL_BTH_GET_LOCAL_INFO, nullptr, 0, &blri, sizeof(blri), &returned, nullptr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -90,10 +92,8 @@ const char* ffDetectBluetoothRadio(FFlist* devices /* FFBluetoothRadioResult */)
|
||||
device->lmpSubversion = blri.radioInfo.lmpSubversion;
|
||||
ffStrbufInitStatic(&device->vendor, ffBluetoothRadioGetVendor(blri.radioInfo.mfg));
|
||||
device->enabled = true;
|
||||
device->connectable = ffBluetoothIsConnectable(hRadio);
|
||||
device->discoverable = ffBluetoothIsDiscoverable(hRadio);
|
||||
|
||||
NtClose(hRadio);
|
||||
device->connectable = ffBluetoothIsConnectable(hCurrent);
|
||||
device->discoverable = ffBluetoothIsDiscoverable(hCurrent);
|
||||
} while (ffBluetoothFindNextRadio(hFind, &hRadio));
|
||||
|
||||
ffBluetoothFindRadioClose(hFind);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/io.h"
|
||||
#include "common/strutil.h"
|
||||
#include "common/FFcache.h"
|
||||
#include "common/mallocHelper.h"
|
||||
#include "detection/gtk_qt/gtk_qt.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
|
||||
@@ -24,12 +26,12 @@ typedef enum PlasmaCategory: uint8_t {
|
||||
} PlasmaCategory;
|
||||
|
||||
static bool detectPlasmaFromFile(const char* filename, FFQtResult* result) {
|
||||
FILE* kdeglobals = fopen(filename, "r");
|
||||
FF_AUTO_CLOSE_FILE FILE* kdeglobals = fopen(filename, "r");
|
||||
if (kdeglobals == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char* line = nullptr;
|
||||
FF_AUTO_FREE char* line = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
PlasmaCategory category = PLASMA_CATEGORY_OTHER;
|
||||
@@ -72,10 +74,6 @@ static bool detectPlasmaFromFile(const char* filename, FFQtResult* result) {
|
||||
}
|
||||
}
|
||||
|
||||
free(line);
|
||||
|
||||
fclose(kdeglobals);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,10 @@ static void detectDeepinTerminal(FFTerminalFontResult* terminalFont) {
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY profile = ffStrbufCreateA(64);
|
||||
ffSearchUserConfigFile(&instance.state.platform.configDirs, "deepin/deepin-terminal/config.conf", &profile);
|
||||
FILE* file = fopen(profile.chars, "r");
|
||||
FF_AUTO_CLOSE_FILE FILE* file = fopen(profile.chars, "r");
|
||||
|
||||
if (file) {
|
||||
char* line = nullptr;
|
||||
FF_AUTO_FREE char* line = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
for (int count = 0; getline(&line, &len, file) != -1 && count < 2;) {
|
||||
@@ -188,9 +188,6 @@ static void detectDeepinTerminal(FFTerminalFontResult* terminalFont) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
free(line);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
if (fontName.length == 0) {
|
||||
|
||||
Reference in New Issue
Block a user