Martin Roth | fb8876d | 2022-08-07 15:12:12 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | |||||
Gabe Black | 1025f3a | 2011-09-16 02:18:56 -0700 | [diff] [blame] | 3 | #include <string.h> |
4 | void *memchr(const void *s, int c, size_t n) | ||||
5 | { | ||||
6 | const unsigned char *sc = s; | ||||
7 | while (n--) { | ||||
8 | if (*sc == (unsigned char)c) | ||||
9 | return (void *)sc; | ||||
10 | sc++; | ||||
11 | } | ||||
12 | return NULL; | ||||
13 | } |