mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
basic: add new ascii_strcasecmp_n() call
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user