Chore: tidy

This commit is contained in:
Carter Li
2026-06-22 10:36:29 +08:00
parent 9f190b46c9
commit 61968ca95c
2 changed files with 3 additions and 7 deletions
+1 -3
View File
@@ -10,7 +10,7 @@ static const char* detectWithBacklight(FFlist* result) {
// https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-backlight
const char* backlightDirPath = "/sys/class/backlight/";
DIR* dirp = opendir(backlightDirPath);
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(backlightDirPath);
if (dirp == NULL) {
return "Failed to open `/sys/class/backlight/`";
}
@@ -72,8 +72,6 @@ static const char* detectWithBacklight(FFlist* result) {
ffStrbufSubstrBefore(&backlightDir, backlightDirLength);
}
closedir(dirp);
return NULL;
}
+2 -4
View File
@@ -84,7 +84,7 @@ static uint32_t countFilesRecursiveImpl(FFstrbuf* baseDirPath, const char* filen
return 1;
}
DIR* dirp = opendir(baseDirPath->chars);
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(baseDirPath->chars);
if (dirp == NULL) {
return 0;
}
@@ -106,7 +106,6 @@ static uint32_t countFilesRecursiveImpl(FFstrbuf* baseDirPath, const char* filen
ffStrbufSubstrBefore(baseDirPath, baseDirPathLength);
}
closedir(dirp);
return sum;
}
@@ -138,7 +137,7 @@ static uint32_t getNumElementsBySuffix(FFstrbuf* baseDir, const char* dirname, c
}
static uint32_t getXBPSImpl(FFstrbuf* baseDir) {
DIR* dir = opendir(baseDir->chars);
FF_AUTO_CLOSE_DIR DIR* dir = opendir(baseDir->chars);
if (dir == NULL) {
return 0;
}
@@ -157,7 +156,6 @@ static uint32_t getXBPSImpl(FFstrbuf* baseDir) {
break;
}
closedir(dir);
return result;
}