summaryrefslogtreecommitdiff
path: root/src/flstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flstring.c')
-rw-r--r--src/flstring.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/flstring.c b/src/flstring.c
index 25346b360..c407ea833 100644
--- a/src/flstring.c
+++ b/src/flstring.c
@@ -98,8 +98,10 @@ fl_strlcpy(char *dst, /* O - Destination string */
int fl_ascii_strcasecmp(const char *s, const char *t) {
if (!s || !t) return (s!=t);
- if (strlen(s) != strlen(t)) return -1;
- for(;*s; s++,t++) {
+ size_t sl=strlen(s), tl=strlen(t);
+ if (sl!=tl) return sl< tl ? -1 : +1;
+
+ for(;*s; s++,t++) {
if (*s == *t) continue;
if (*s < *t) {
if ( (*s+0x20)!=*t || !C_RANGE(*s,'A','Z') ) return -1;
@@ -107,6 +109,7 @@ int fl_ascii_strcasecmp(const char *s, const char *t) {
if ( (*s-0x20)!=*t || !C_RANGE(*s,'a','z') ) return +1;
}
}
+
return 0;
}