lib: better optimized casecompare() and ncasecompare()

Less 'jne` or `je` CPU instructions.

Closes #16311
This commit is contained in:
Sergey 2025-02-12 17:14:08 -08:00 committed by Daniel Stenberg
parent 57495c6487
commit c1341813bd
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -91,7 +91,7 @@ char Curl_raw_tolower(char in)
static int casecompare(const char *first, const char *second)
{
while(*first && *second) {
while(*first) {
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
/* get out of the loop as soon as they do not match */
return 0;
@ -118,7 +118,7 @@ int curl_strequal(const char *first, const char *second)
static int ncasecompare(const char *first, const char *second, size_t max)
{
while(*first && *second && max) {
while(*first && max) {
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
return 0;
max--;