Skip to content

Commit 376bd08

Browse files
committed
Buildfix for strcasecmp not being found for Windows
1 parent a158a37 commit 376bd08

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

libretro-common/include/string/stdstring.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,20 @@ static INLINE size_t strlen_size(const char *str, size_t len)
117117
static INLINE bool string_is_equal_case_insensitive(const char *a,
118118
const char *b)
119119
{
120-
if (a == b)
121-
return true;
120+
int result = 0;
121+
const unsigned char *p1 = (const unsigned char*)a;
122+
const unsigned char *p2 = (const unsigned char*)b;
123+
122124
if (!a || !b)
123125
return false;
124-
return strcasecmp(a, b) == 0;
126+
if (p1 == p2)
127+
return true;
128+
129+
while ((result = tolower (*p1) - tolower (*p2++)) == 0)
130+
if (*p1++ == '\0')
131+
break;
132+
133+
return (result == 0);
125134
}
126135

127136
static INLINE bool string_starts_with_case_insensitive(const char *str,

0 commit comments

Comments
 (0)