diff options
Diffstat (limited to 'src/basic/string-util.c')
-rw-r--r-- | src/basic/string-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c index b7b8c97bc0..1f95a9abba 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -363,6 +363,21 @@ int ascii_strcasecmp_n(const char *a, const char *b, size_t n) { return 0; } +int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m) { + int r; + + r = ascii_strcasecmp_n(a, b, MIN(n, m)); + if (r != 0) + return r; + + if (n < m) + return -1; + else if (n > m) + return 1; + else + return 0; +} + bool chars_intersect(const char *a, const char *b) { const char *p; |