[libc-commits] [libc] [libc][NFC] replace NULL with nullptr (PR #134464)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri Apr 4 16:40:05 PDT 2025
https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/134464
Simple cleanup
>From 9b27a6d378c190ac5f782345a2425e25ddcb769e Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Fri, 4 Apr 2025 16:39:25 -0700
Subject: [PATCH] [libc][NFC] replace NULL with nullptr
Simple cleanup
---
libc/src/sys/time/linux/utimes.cpp | 6 +++---
libc/test/src/time/ctime_test.cpp | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
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