diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-12-18 13:50:01 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-12-18 13:50:01 +0000 |
commit | 00fd4513a6cd6195655aec7297c974acb835d4a3 (patch) | |
tree | 75d2f319b36cb21d39500d9c077e2b9404344b5e /src | |
parent | 37b38dadd77079cd7e537f247dcb0a45301e539b (diff) | |
download | skalibs-00fd4513a6cd6195655aec7297c974acb835d4a3.tar.xz |
and one more
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libstddjb/byte_chr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstddjb/byte_chr.c b/src/libstddjb/byte_chr.c index ba774aa..8203433 100644 --- a/src/libstddjb/byte_chr.c +++ b/src/libstddjb/byte_chr.c @@ -5,6 +5,8 @@ size_t byte_chr (char const *s, size_t n, int c) { - void *p = memchr(s, c, n) ; + void *p ; + if (!n) return 0 ; + p = memchr(s, c, n) ; return p ? (char *)p - s : n ; } |