From c117abe06abb6a14459a9b8b4e5c3d2f00cd7d29 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 17 May 2020 19:29:44 +0200 Subject: [PATCH] mescc: Mes C Library: Prepare for M2-Planet: strcmp. * lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet. --- lib/string/strcmp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/string/strcmp.c b/lib/string/strcmp.c index 40c43111..b0fee260 100644 --- a/lib/string/strcmp.c +++ b/lib/string/strcmp.c @@ -23,10 +23,11 @@ int strcmp (char const *a, char const *b) { - while (*a && *b && *a == *b) + while (a[0] != 0 && b[0] != 0 && a[0] == b[0]) { - a++; - b++; + a = a + 1; + b = b + 1; } - return *a - *b; + + return a[0] - b[0]; }