diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-29 23:10:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 23:10:21 +0800 |
commit | 86cc791debba09c8ed1aa0d863be844108866a38 (patch) | |
tree | 7231cc3940e88ee6c6f963f641c99d23422ffc90 /src/nvim/strings.c | |
parent | 18c1fd8e9d759da6806747910320dce6bea2ab42 (diff) | |
download | rneovim-86cc791debba09c8ed1aa0d863be844108866a38.tar.gz rneovim-86cc791debba09c8ed1aa0d863be844108866a38.tar.bz2 rneovim-86cc791debba09c8ed1aa0d863be844108866a38.zip |
refactor: move function macros out of vim_defs.h (#26300)
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r-- | src/nvim/strings.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 1533a486bc..a439d11818 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -380,18 +380,6 @@ void del_trailing_spaces(char *ptr) } } -#if !defined(HAVE_STRNLEN) -size_t xstrnlen(const char *s, size_t n) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE -{ - const char *end = memchr(s, '\0', n); - if (end == NULL) { - return n; - } - return (size_t)(end - s); -} -#endif - #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) // Compare two strings, ignoring case, using current locale. // Doesn't work for multi-byte characters. @@ -441,6 +429,13 @@ int vim_strnicmp(const char *s1, const char *s2, size_t len) } #endif +/// Case-insensitive `strequal`. +bool striequal(const char *a, const char *b) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT +{ + return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0); +} + /// strchr() version which handles multibyte strings /// /// @param[in] string String to search in. |