Global: replaces NULL to nullptr

This commit is contained in:
李通洲
2026-07-10 18:08:04 +08:00
parent 873454191f
commit ba18705d2e
387 changed files with 2411 additions and 2411 deletions
+1 -1
View File
@@ -59,5 +59,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
}
}
return NULL;
return nullptr;
}
+12 -12
View File
@@ -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;
}
+1 -1
View File
@@ -78,5 +78,5 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
ffCPUCacheAddItem(result, level, size, 0, type);
}
return NULL;
return nullptr;
}
+3 -3
View File
@@ -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;
}