From 0ccf694bc52463e68a077ce7bac78487a43932a1 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 5 Feb 2002 22:01:06 +0000 Subject: [PATCH] The previous fix was complete nonsense. What a day. :-( --- ascii.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ascii.c b/ascii.c index 59dfb440..d4553f68 100644 --- a/ascii.c +++ b/ascii.c @@ -67,13 +67,13 @@ int ascii_strcasecmp (const char *a, const char *b) if (b == NULL && a) return 1; - for (; *a && *b; a++, b++) + for (; *a || *b; a++, b++) { if ((i = ascii_tolower (*a) - ascii_tolower (*b))) return i; } - - return ascii_tolower (*a) - ascii_tolower (*b); + + return 0; } int ascii_strncasecmp (const char *a, const char *b, int n) @@ -87,13 +87,11 @@ int ascii_strncasecmp (const char *a, const char *b, int n) if (b == NULL && a) return 1; - for (j = 0; (*a && *b) && j < n; a++, b++, j++) + for (j = 0; (*a || *b) && j < n; a++, b++, j++) { if ((i = ascii_tolower (*a) - ascii_tolower (*b))) return i; } - if (j < n) - return ascii_tolower (*a) - ascii_tolower (*b); - else - return 0; + + return 0; } -- 2.40.0