llvm-project
50c44478 - [libc] fix behavior of strrchr(x, '\0') (#112620)

Commit
1 year ago
[libc] fix behavior of strrchr(x, '\0') (#112620) `strrchr("foo", '\0')` is defined to point to the end of `foo`, rather than returning NULL. This wasn't caught by tests, since llvm-libc's `ASSERT_STREQ(nullptr, "");` is not an assertion error. While I'm here, refactor the test slightly to check for NULL more specifically. I considered adding fancier `ASSERT`s (and changing the semantics of `ASSERT_STREQ`), but opted for a more local fix by fair dice roll.
Author
Parents
Loading