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 (janneke) Nieuwenhuizen 2020-05-17 19:29:18 +02:00
parent b4895d7495
commit b20a388715
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

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;
}