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

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

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,10 +27,12 @@ memcmp (void const *s1, void const *s2, size_t size)
return 0;
char const *a = s1;
char const *b = s2;
while (*a == *b && --size)
while (a[0] == b[0] && size > 0)
{
a++;
b++;
size = size - 1;
a = a + 1;
b = b + 1;
}
return *a - *b;
return a[0] - b[0];
}