diff options
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/strcasecmp.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/firmware/common/strcasecmp.c b/firmware/common/strcasecmp.c index 7bd0d61dd5..b9dd6c13c4 100644 --- a/firmware/common/strcasecmp.c +++ b/firmware/common/strcasecmp.c | |||
@@ -14,15 +14,15 @@ int strcasecmp(const char *s1, const char *s2) | |||
14 | 14 | ||
15 | int strncasecmp(const char *s1, const char *s2, size_t n) | 15 | int strncasecmp(const char *s1, const char *s2, size_t n) |
16 | { | 16 | { |
17 | if(!n) | 17 | int d = 0; |
18 | return 0; | 18 | |
19 | 19 | for(; n != 0; n--) | |
20 | while (n-- != 0 && tolower(*s1) == tolower(*s2)) { | 20 | { |
21 | if(n == 0 || *s1 == '\0') | 21 | int c1 = tolower(*s1++); |
22 | break; | 22 | int c2 = tolower(*s2++); |
23 | s1++; | 23 | if((d = c1 - c2) != 0 || c2 == '\0') |
24 | s2++; | 24 | break; |
25 | } | 25 | } |
26 | 26 | ||
27 | return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); | 27 | return d; |
28 | } | 28 | } |