Skip to content

Conversation

@michaelrj-google
Copy link
Contributor

Simple cleanup

@llvmbot llvmbot added the libc label Apr 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 4, 2025

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

Simple cleanup


Full diff: https://github.com/llvm/llvm-project/pull/134464.diff

2 Files Affected:

  • (modified) libc/src/sys/time/linux/utimes.cpp (+3-3)
  • (modified) libc/test/src/time/ctime_test.cpp (+4-4)
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);
 }

@michaelrj-google michaelrj-google merged commit e8b52ac into llvm:main Apr 4, 2025
18 checks passed
@michaelrj-google michaelrj-google deleted the libcNullCleanup branch April 4, 2025 23:55
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Apr 29, 2025
Local branch origin/amd-gfx 636b44b Merged main:65b85bf8bcb6 into origin/amd-gfx:b327f5fd8354
Remote branch main e8b52ac [libc][NFC] replace NULL with nullptr (llvm#134464)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants