[libc-commits] [libc] [libc] fix behavior of strrchr(x, '\0') (PR #112620)

George Burgess IV via libc-commits libc-commits at lists.llvm.org
Fri Oct 18 11:39:20 PDT 2024


================
@@ -114,25 +117,25 @@ template <auto Func> struct StrrchrTest : public LIBC_NAMESPACE::testing::Test {
     const char *src = "abcde";
 
     // Should return null terminator.
-    ASSERT_STREQ(Func(src, '\0'), "");
+    ASSERT_TRUE(Func(src, '\0') != nullptr);
----------------
gburgessiv wrote:

Ah, good catch. I mirrored the `// Should return null terminator. change from above.` Happy to do `Func(src, '\0') != nullptr && *Func(src, '\0') == '\0'` if you all would prefer; just want to keep the two in sync

https://github.com/llvm/llvm-project/pull/112620


More information about the libc-commits mailing list