libc: fix memchr() prototype

The standard memchr() uses an int for its second argument.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2019-07-08 23:02:59 -04:00 committed by Andrew Boie
commit ffab197928
2 changed files with 3 additions and 3 deletions

View file

@ -36,7 +36,7 @@ extern void *memmove(void *d, const void *s, size_t n);
extern void *memcpy(void *_MLIBC_RESTRICT d, const void *_MLIBC_RESTRICT s,
size_t n);
extern void *memset(void *buf, int c, size_t n);
extern void *memchr(const void *s, unsigned char c, size_t n);
extern void *memchr(const void *s, int c, size_t n);
#ifdef __cplusplus
}

View file

@ -357,13 +357,13 @@ void *memset(void *buf, int c, size_t n)
* @return pointer to start of found byte
*/
void *memchr(const void *s, unsigned char c, size_t n)
void *memchr(const void *s, int c, size_t n)
{
if (n != 0) {
const unsigned char *p = s;
do {
if (*p++ == c) {
if (*p++ == (unsigned char)c) {
return ((void *)(p - 1));
}