diff options
Diffstat (limited to 'src/string.c')
-rw-r--r-- | src/string.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index 46f8ff9a..a1151c60 100644 --- a/src/string.c +++ b/src/string.c @@ -1,10 +1,14 @@ -// Copyright 2011-2020 David Robillard <d@drobilla.net> +// Copyright 2011-2021 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC #include "memory.h" +#include "string_utils.h" #include "serd/memory.h" #include "serd/status.h" +#include "serd/string.h" + +#include <stddef.h> void serd_free(SerdAllocator* const allocator, void* const ptr) @@ -62,3 +66,15 @@ serd_strerror(const SerdStatus status) return "Unknown error"; } + +int +serd_strncasecmp(const char* s1, const char* s2, size_t n) +{ + for (; n > 0 && *s2; s1++, s2++, --n) { + if (serd_to_lower(*s1) != serd_to_lower(*s2)) { + return (*s1 < *s2) ? -1 : +1; + } + } + + return 0; +} |