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:
parent
55dc481a15
commit
ffab197928
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue