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/memory.h | |
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/memory.h')
-rw-r--r-- | src/nvim/memory.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/memory.h b/src/nvim/memory.h index c37866ebc5..ffdc4c7366 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -4,6 +4,7 @@ #include <stdint.h> // IWYU pragma: keep #include <time.h> // IWYU pragma: keep +#include "auto/config.h" #include "nvim/macros_defs.h" #include "nvim/memory_defs.h" // IWYU pragma: export @@ -57,3 +58,17 @@ EXTERN size_t arena_alloc_count INIT( = 0); *ptr_ = NULL; \ (void)(*ptr_); \ } while (0) + +#define CLEAR_FIELD(field) memset(&(field), 0, sizeof(field)) +#define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr))) + +#ifndef HAVE_STRNLEN +# define strnlen xstrnlen // Older versions of SunOS may not have strnlen +#endif + +#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) // NOLINT(runtime/printf) + +// Like strcpy() but allows overlapped source and destination. +#define STRMOVE(d, s) memmove((d), (s), strlen(s) + 1) + +#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) // NOLINT(runtime/printf) |