mescc: Mes C Library: Prepare for M2-Planet: memchr.

* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-20 19:29:18 +02:00
parent f96a548103
commit 5ab4840e03
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 7 additions and 4 deletions

View File

@ -24,11 +24,14 @@ void *
memchr (void const *block, int c, size_t size)
{
char const *p = block;
while (size--)
while (size != 0)
{
if (c == *p)
return (void *) p;
p++;
size = size - 1;
if (c == p[0])
return p;
p = p + 1;
}
return 0;
}