[libc-commits] [libc] e8b52ac - [libc][NFC] replace NULL with nullptr (#134464)
via libc-commits
libc-commits at lists.llvm.org
Fri Apr 4 16:55:47 PDT 2025
Author: Michael Jones
Date: 2025-04-04T16:55:43-07:00
New Revision: e8b52acca2376aac90ba8e2927e52ddd5253bcbb
URL: https://github.com/llvm/llvm-project/commit/e8b52acca2376aac90ba8e2927e52ddd5253bcbb
DIFF: https://github.com/llvm/llvm-project/commit/e8b52acca2376aac90ba8e2927e52ddd5253bcbb.diff
LOG: [libc][NFC] replace NULL with nullptr (#134464)
Simple cleanup
Added:
Modified:
libc/src/sys/time/linux/utimes.cpp
libc/test/src/time/ctime_test.cpp
Removed:
################################################################################
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index 1cc5a8344e91a..e6e3d073a81a4 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -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.
diff --git a/libc/test/src/time/ctime_test.cpp b/libc/test/src/time/ctime_test.cpp
index 7ec71bb1e4ed1..6f1168f0b6685 100644
--- a/libc/test/src/time/ctime_test.cpp
+++ b/libc/test/src/time/ctime_test.cpp
@@ -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);
}
More information about the libc-commits
mailing list