diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-11 15:44:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 15:44:55 +0800 |
commit | 94c317647845b92d675548a481f664a6a1808426 (patch) | |
tree | 5d14079cbf334b1148fbc6927793bc1df72934c5 /src/nvim/vim.h | |
parent | 252dea5927906208ab60f68d70891a82ab9ddd18 (diff) | |
download | rneovim-94c317647845b92d675548a481f664a6a1808426.tar.gz rneovim-94c317647845b92d675548a481f664a6a1808426.tar.bz2 rneovim-94c317647845b92d675548a481f664a6a1808426.zip |
refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)
vim-patch:8.2.0559: clearing a struct is verbose
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
Diffstat (limited to 'src/nvim/vim.h')
-rw-r--r-- | src/nvim/vim.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 31ac5a67ff..b2c7df4cbb 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -199,6 +199,7 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() // Size in bytes of the hash used in the undo file. #define UNDO_HASH_SIZE 32 +#define CLEAR_FIELD(field) memset(&(field), 0, sizeof(field)) #define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr))) // defines to avoid typecasts from (char_u *) to (char *) and back |