From 0f1b2b646beb2639f73766f0e505000154892bbd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 25 Nov 2021 15:57:39 +0100 Subject: [PATCH] remove questionable optimization from case-insensitive string comparison we optimized the case where the string would be equal even without upper-casing, but for the much more common case where the strings differ even after upper-casing, this was just an additional conditional. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index 419c6e1..3ac0e24 100644 --- a/src/util.c +++ b/src/util.c @@ -300,7 +300,7 @@ starts_with_upper( const char *str, int strl, const char *cmp, uint cmpl ) if ((uint)strl < cmpl) return 0; for (uint i = 0; i < cmpl; i++) - if (str[i] != cmp[i] && toupper( str[i] ) != cmp[i]) + if (toupper( str[i] ) != cmp[i]) return 0; return 1; }