[libc][NFC] replace NULL with nullptr (#134464)

Simple cleanup
This commit is contained in:
Michael Jones
2025-04-04 16:55:43 -07:00
committed by GitHub
parent 7001993880
commit e8b52acca2
2 changed files with 7 additions and 7 deletions

View File

@@ -30,11 +30,11 @@ LLVM_LIBC_FUNCTION(int, utimes,
#elif defined(SYS_utimensat)
// the utimensat syscall requires a timespec struct, not timeval.
struct timespec ts[2];
struct timespec *ts_ptr = nullptr; // default value if times is NULL
struct timespec *ts_ptr = nullptr; // default value if times is nullptr
// convert the microsec values in timeval struct times
// to nanosecond values in timespec struct ts
if (times != NULL) {
if (times != nullptr) {
// ensure consistent values
if ((times[0].tv_usec < 0 || times[1].tv_usec < 0) ||
@@ -54,7 +54,7 @@ LLVM_LIBC_FUNCTION(int, utimes,
ts_ptr = ts;
}
// If times was NULL, ts_ptr remains NULL, which utimensat interprets
// If times was nullptr, ts_ptr remains nullptr, which utimensat interprets
// as setting times to the current time.
// utimensat syscall.

View File

@@ -11,10 +11,10 @@
#include "test/UnitTest/Test.h"
#include "test/src/time/TmHelper.h"
TEST(LlvmLibcCtime, NULL) {
TEST(LlvmLibcCtime, nullptr) {
char *result;
result = LIBC_NAMESPACE::ctime(NULL);
ASSERT_STREQ(NULL, result);
result = LIBC_NAMESPACE::ctime(nullptr);
ASSERT_STREQ(nullptr, result);
}
TEST(LlvmLibcCtime, ValidUnixTimestamp0) {
@@ -38,5 +38,5 @@ TEST(LlvmLibcCtime, InvalidArgument) {
char *result;
t = 2147483648;
result = LIBC_NAMESPACE::ctime(&t);
ASSERT_STREQ(NULL, result);
ASSERT_STREQ(nullptr, result);
}