From c6ae0f41a31183f54f593774ce6e673526982de5 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 17 Jun 2018 10:18:59 +0200 Subject: [PATCH] mescc: Support binutils 2.25: memcmp: Support size 0. * lib/libc+tcc.c (memcmp): Support size 0. --- lib/libc+tcc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libc+tcc.c b/lib/libc+tcc.c index 65195bfa..5832f7a9 100644 --- a/lib/libc+tcc.c +++ b/lib/libc+tcc.c @@ -335,11 +335,17 @@ memset (void *s, int c, size_t n) } int -memcmp (void const *s1, void const *s2, size_t n) +memcmp (void const *s1, void const *s2, size_t size) { + if (!size) + return 0; char *a = s1; char *b = s2; - while (*a == *b && --n) {a++;b++;} + while (*a == *b && --size) + { + a++; + b++; + } return *a - *b; }