basic: add new ascii_strcasecmp_n() call

This commit is contained in:
Lennart Poettering
2016-01-13 02:21:16 +01:00
parent 4b2e9cfcf0
commit 522d85ae0a
3 changed files with 45 additions and 0 deletions

View File

@@ -348,6 +348,21 @@ char *ascii_strlower_n(char *t, size_t n) {
return t;
}
int ascii_strcasecmp_n(const char *a, const char *b, size_t n) {
for (; n > 0; a++, b++, n--) {
int x, y;
x = (int) (uint8_t) ascii_tolower(*a);
y = (int) (uint8_t) ascii_tolower(*b);
if (x != y)
return x - y;
}
return 0;
}
bool chars_intersect(const char *a, const char *b) {
const char *p;