[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Fri Feb 7 13:11:05 PST 2025
================
@@ -18,7 +18,9 @@ namespace LIBC_NAMESPACE_DECL {
// TODO: Look at performance benefits of comparing words.
LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) {
- LIBC_CRASH_ON_NULLPTR(src);
+ if (n > 0) {
+ LIBC_CRASH_ON_NULLPTR(src);
+ }
----------------
nickdesaulniers wrote:
When you have a single statement in a conditional (or loop), it's llvm style to omit the `{}`.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list