mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
refactor: move function macros out of vim_defs.h (#26300)
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user