mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 09:56:31 +00:00
refactor: move function macros out of vim_defs.h (#26300)
This commit is contained in:
@@ -213,6 +213,18 @@ void *xmemdupz(const void *data, size_t len)
|
||||
return memcpy(xmallocz(len), data, len);
|
||||
}
|
||||
|
||||
#ifndef 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
|
||||
|
||||
/// A version of strchr() that returns a pointer to the terminating NUL if it
|
||||
/// doesn't find `c`.
|
||||
///
|
||||
@@ -496,13 +508,6 @@ bool strequal(const char *a, const char *b)
|
||||
return (a == NULL && b == NULL) || (a && b && strcmp(a, b) == 0);
|
||||
}
|
||||
|
||||
/// 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);
|
||||
}
|
||||
|
||||
// Avoid repeating the error message many times (they take 1 second each).
|
||||
// Did_outofmem_msg is reset when a character is read.
|
||||
void do_outofmem_msg(size_t size)
|
||||
|
Reference in New Issue
Block a user