mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 04:34:19 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -59,5 +59,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
|
||||
uint32_t baseLen = path->length;
|
||||
ffStrbufAppendS(path, "/level");
|
||||
if (!ffReadFileBuffer(path->chars, buffer)) {
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/level\") == NULL";
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/level\") == nullptr";
|
||||
}
|
||||
|
||||
uint32_t level = (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
@@ -17,7 +17,7 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
ffStrbufAppendS(path, "/size");
|
||||
if (!ffReadFileBuffer(path->chars, buffer)) {
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/size\") == NULL";
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/size\") == nullptr";
|
||||
}
|
||||
|
||||
uint32_t sizeKb = (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
@@ -28,7 +28,7 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
ffStrbufAppendS(path, "/type");
|
||||
if (!ffReadFileBuffer(path->chars, buffer)) {
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/type\") == NULL";
|
||||
return "ffReadFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/type\") == nullptr";
|
||||
}
|
||||
ffStrbufTrimRightSpace(buffer);
|
||||
|
||||
@@ -62,7 +62,7 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
|
||||
ffStrbufClear(buffer);
|
||||
ffStrbufAppendC(buffer, '[');
|
||||
if (!ffAppendFileBuffer(path->chars, buffer)) {
|
||||
return "ffAppendFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/shared_cpu_list\") == NULL";
|
||||
return "ffAppendFileBuffer(\"/sys/devices/system/cpu/cpuX/cache/indexX/shared_cpu_list\") == nullptr";
|
||||
}
|
||||
ffStrbufTrimRightSpace(buffer);
|
||||
|
||||
@@ -70,11 +70,11 @@ static const char* parseCpuCacheIndex(FFstrbuf* path, FFCPUCacheResult* result,
|
||||
ffStrbufAppendF(buffer, "_%u_%u_%u_%u]", level, sizeKb, lineSize, cacheType);
|
||||
|
||||
if (ffStrbufContain(added, buffer)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
ffStrbufAppend(added, buffer);
|
||||
ffCPUCacheAddItem(result, level, sizeKb * 1024, lineSize, cacheType);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const char* parseCpuCache(FFstrbuf* path, FFCPUCacheResult* result, FFstrbuf* buffer, FFstrbuf* added) {
|
||||
@@ -82,11 +82,11 @@ static const char* parseCpuCache(FFstrbuf* path, FFCPUCacheResult* result, FFstr
|
||||
uint32_t baseLen = path->length;
|
||||
FF_AUTO_CLOSE_DIR DIR* pathCacheDir = opendir(path->chars);
|
||||
if (!pathCacheDir) {
|
||||
return "opendir(\"/sys/devices/system/cpu/cpuX/cache/\") == NULL";
|
||||
return "opendir(\"/sys/devices/system/cpu/cpuX/cache/\") == nullptr";
|
||||
}
|
||||
|
||||
struct dirent* pathCacheEntry;
|
||||
while ((pathCacheEntry = readdir(pathCacheDir)) != NULL) {
|
||||
while ((pathCacheEntry = readdir(pathCacheDir)) != nullptr) {
|
||||
if (!ffStrStartsWith(pathCacheEntry->d_name, "index") || !ffCharIsDigit(pathCacheEntry->d_name[strlen("index")])) {
|
||||
continue;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ static const char* parseCpuCache(FFstrbuf* path, FFCPUCacheResult* result, FFstr
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
@@ -108,14 +108,14 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
uint32_t baseLen = path.length;
|
||||
FF_AUTO_CLOSE_DIR DIR* pathCpuDir = opendir(path.chars);
|
||||
if (!pathCpuDir) {
|
||||
return "opendir(\"/sys/devices/system/cpu/\") == NULL";
|
||||
return "opendir(\"/sys/devices/system/cpu/\") == nullptr";
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY added = ffStrbufCreate();
|
||||
|
||||
struct dirent* pathCpuEntry;
|
||||
while ((pathCpuEntry = readdir(pathCpuDir)) != NULL) {
|
||||
while ((pathCpuEntry = readdir(pathCpuDir)) != nullptr) {
|
||||
if (!ffStrStartsWith(pathCpuEntry->d_name, "cpu") ||
|
||||
!ffCharIsDigit(pathCpuEntry->d_name[strlen("cpu")])) {
|
||||
continue;
|
||||
@@ -128,5 +128,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
}
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -78,5 +78,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
ffCPUCacheAddItem(result, level, size, 0, type);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
LOGICAL_PROCESSOR_RELATIONSHIP lpr = RelationCache;
|
||||
DWORD length = 0;
|
||||
NtQuerySystemInformationEx(SystemLogicalProcessorAndGroupInformation, &lpr, sizeof(lpr), NULL, 0, &length);
|
||||
NtQuerySystemInformationEx(SystemLogicalProcessorAndGroupInformation, &lpr, sizeof(lpr), nullptr, 0, &length);
|
||||
if (length == 0) {
|
||||
return "GetLogicalProcessorInformationEx(RelationCache, NULL, &length) failed";
|
||||
return "GetLogicalProcessorInformationEx(RelationCache, nullptr, &length) failed";
|
||||
}
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
@@ -43,5 +43,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user