Mercurial > hg > dmlib
comparison src/dmstring.c @ 2490:18ec4c092108
Fix dm_strncasecmp() edge case.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 28 Apr 2020 18:38:38 +0300 |
parents | 63dd0a611586 |
children | fcaf2db0cd05 |
comparison
equal
deleted
inserted
replaced
2489:c64806412be0 | 2490:18ec4c092108 |
---|---|
43 s1++; | 43 s1++; |
44 s2++; | 44 s2++; |
45 n--; | 45 n--; |
46 } | 46 } |
47 | 47 |
48 return tolower(*s1) - tolower(*s2); | 48 return (n == 0) ? 0 : tolower(*s1) - tolower(*s2); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 /* Check if end of the given string str matches needle | 52 /* Check if end of the given string str matches needle |
53 * case-insensitively, return pointer to start of the match, | 53 * case-insensitively, return pointer to start of the match, |