mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
Windows / macOS: simplify code
1. simplify resource management by using C++ RAII like GCC attribute extension `cleanup` 2. simplify HEKY reading Actually `__attribute__((__cleanup__(cleanupFn)))` is supported on all major C compiler ( gcc, clang and icc ) except MSVC I only used it on Windows and macOS for now. Let's see if the project author like it.
This commit is contained in:
@@ -15,7 +15,7 @@ static double getFrequency(const char* propName)
|
||||
|
||||
static double detectCpuTemp(const FFstrbuf* cpuName)
|
||||
{
|
||||
FFlist temps;
|
||||
FF_LIST_AUTO_DESTROY temps;
|
||||
ffListInit(&temps, sizeof(FFTempValue));
|
||||
|
||||
if(ffStrbufStartsWithS(cpuName, "Apple M1"))
|
||||
@@ -38,7 +38,6 @@ static double detectCpuTemp(const FFstrbuf* cpuName)
|
||||
ffStrbufDestroy(&tempValue->deviceClass);
|
||||
}
|
||||
result /= temps.length;
|
||||
ffListDestroy(&temps);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user