[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
================
@@ -10,13 +10,18 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
#include <stddef.h> // For size_t.
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(void *, memccpy,
(void *__restrict dest, const void *__restrict src, int c,
size_t count)) {
+ if (c > 0) {
----------------
nickdesaulniers wrote:
`size_t` is unsigned right? That's why there's `ssize_t`. So `{unsigned type} > 0` is a tautology. Then this can just be `if (c)`. Here and throughout this patch (when the count is a `size_t`, not an `int`! Luckily I don't think there's any `int` params in this diff.)
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list