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
+3 -3
View File
@@ -22,14 +22,14 @@ void ffPrepareDiskIO(FFDiskIOOptions* options) {
}
const char* ffDetectDiskIO(FFlist* result, FFDiskIOOptions* options) {
const char* error = NULL;
const char* error = nullptr;
if (options->detectTotal) {
error = ffDiskIOGetIoCounters(result, options);
if (error) {
return error;
}
return NULL;
return nullptr;
}
if (time1 == 0) {
@@ -84,5 +84,5 @@ const char* ffDetectDiskIO(FFlist* result, FFDiskIOOptions* options) {
time1 = time2;
// Leak ioCounters1 here
return NULL;
return nullptr;
}
+1 -1
View File
@@ -53,5 +53,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
}
}
return NULL;
return nullptr;
}
+4 -4
View File
@@ -27,12 +27,12 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
}
struct devstat* snapIter;
while ((snapIter = geom_stats_snapshot_next(snap)) != NULL) {
while ((snapIter = geom_stats_snapshot_next(snap)) != nullptr) {
if (snapIter->device_type & DEVSTAT_TYPE_PASS) {
continue;
}
struct gident* geomId = geom_lookupid(&geomTree, snapIter->id);
if (geomId == NULL) {
if (geomId == nullptr) {
continue;
}
if (geomId->lg_what != ISPROVIDER) {
@@ -69,7 +69,7 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
geom_stats_snapshot_free(snap);
geom_stats_close();
return NULL;
return nullptr;
}
#else
@@ -114,7 +114,7 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
free(stats.dinfo->mem_ptr);
free(stats.dinfo);
return NULL;
return nullptr;
}
#endif
+5 -5
View File
@@ -72,17 +72,17 @@ static const char* parseDiskIOCounters(int dfd, const char* devName, FFlist* res
device->readCount = nRead;
device->writeCount = nWritten;
return NULL;
return nullptr;
}
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
FF_AUTO_CLOSE_DIR DIR* sysBlockDirp = opendir("/sys/block/");
if (sysBlockDirp == NULL) {
return "opendir(\"/sys/block/\") == NULL";
if (sysBlockDirp == nullptr) {
return "opendir(\"/sys/block/\") == nullptr";
}
struct dirent* sysBlockEntry;
while ((sysBlockEntry = readdir(sysBlockDirp)) != NULL) {
while ((sysBlockEntry = readdir(sysBlockDirp)) != nullptr) {
const char* const devName = sysBlockEntry->d_name;
if (devName[0] == '.') {
@@ -95,5 +95,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
}
}
return NULL;
return nullptr;
}
+4 -4
View File
@@ -9,14 +9,14 @@
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
int mib[] = { CTL_HW, HW_IOSTATS, sizeof(struct io_sysctl) };
size_t len;
if (sysctl(mib, ARRAY_SIZE(mib), NULL, &len, NULL, 0) < 0) {
return "sysctl({HW_IOSTATS}, NULL) failed";
if (sysctl(mib, ARRAY_SIZE(mib), nullptr, &len, nullptr, 0) < 0) {
return "sysctl({HW_IOSTATS}, nullptr) failed";
}
uint32_t nDrive = (uint32_t) (len / sizeof(struct io_sysctl));
FF_AUTO_FREE struct io_sysctl* stats = malloc(len);
if (sysctl(mib, ARRAY_SIZE(mib), stats, &len, NULL, 0) < 0) {
if (sysctl(mib, ARRAY_SIZE(mib), stats, &len, nullptr, 0) < 0) {
return "sysctl({HW_IOSTATS}, stats) failed";
}
@@ -46,5 +46,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
device->writeCount = st->wxfer;
}
return NULL;
return nullptr;
}
+4 -4
View File
@@ -8,14 +8,14 @@
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
int mib[] = { CTL_HW, HW_DISKSTATS };
size_t len;
if (sysctl(mib, ARRAY_SIZE(mib), NULL, &len, NULL, 0) < 0) {
return "sysctl({HW_DISKSTATS}, NULL) failed";
if (sysctl(mib, ARRAY_SIZE(mib), nullptr, &len, nullptr, 0) < 0) {
return "sysctl({HW_DISKSTATS}, nullptr) failed";
}
uint32_t nDrive = (uint32_t) (len / sizeof(struct diskstats));
FF_AUTO_FREE struct diskstats* stats = malloc(len);
if (sysctl(mib, ARRAY_SIZE(mib), stats, &len, NULL, 0) < 0) {
if (sysctl(mib, ARRAY_SIZE(mib), stats, &len, nullptr, 0) < 0) {
return "sysctl({HW_DISKSTATS}, stats) failed";
}
@@ -35,5 +35,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
device->writeCount = st->ds_wxfer;
}
return NULL;
return nullptr;
}
+1 -1
View File
@@ -38,5 +38,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
device->writeCount = kio.writes;
}
return NULL;
return nullptr;
}
+4 -4
View File
@@ -6,7 +6,7 @@
#include <winioctl.h>
static bool detectPhysicalDisk(const wchar_t* szDevice, FFlist* result, FFDiskIOOptions* options) {
FF_AUTO_CLOSE_FD HANDLE hDevice = CreateFileW(szDevice, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
FF_AUTO_CLOSE_FD HANDLE hDevice = CreateFileW(szDevice, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hDevice == INVALID_HANDLE_VALUE) {
return false;
}
@@ -24,7 +24,7 @@ static bool detectPhysicalDisk(const wchar_t* szDevice, FFlist* result, FFDiskIO
&sddBuffer,
ARRAY_SIZE(sddBuffer),
&retSize,
NULL) ||
nullptr) ||
retSize == 0) {
return true;
}
@@ -57,7 +57,7 @@ static bool detectPhysicalDisk(const wchar_t* szDevice, FFlist* result, FFDiskIO
}
DISK_PERFORMANCE dp = {};
if (DeviceIoControl(hDevice, IOCTL_DISK_PERFORMANCE, NULL, 0, &dp, sizeof(dp), &retSize, NULL)) {
if (DeviceIoControl(hDevice, IOCTL_DISK_PERFORMANCE, nullptr, 0, &dp, sizeof(dp), &retSize, nullptr)) {
device->bytesRead = (uint64_t) dp.BytesRead.QuadPart;
device->readCount = (uint64_t) dp.ReadCount;
device->bytesWritten = (uint64_t) dp.BytesWritten.QuadPart;
@@ -97,5 +97,5 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
}
}
return NULL;
return nullptr;
}