aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-11 15:44:55 +0800
committerGitHub <noreply@github.com>2022-08-11 15:44:55 +0800
commit94c317647845b92d675548a481f664a6a1808426 (patch)
tree5d14079cbf334b1148fbc6927793bc1df72934c5 /src/nvim/eval/typval.c
parent252dea5927906208ab60f68d70891a82ab9ddd18 (diff)
downloadrneovim-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/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index ff1808ed91..8822bb0491 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -233,7 +233,7 @@ void tv_list_init_static10(staticList10_T *const sl)
#define SL_SIZE ARRAY_SIZE(sl->sl_items)
list_T *const l = &sl->sl_list;
- memset(sl, 0, sizeof(staticList10_T));
+ CLEAR_POINTER(sl);
l->lv_first = &sl->sl_items[0];
l->lv_last = &sl->sl_items[SL_SIZE - 1];
l->lv_refcount = DO_NOT_FREE_CNT;
@@ -261,7 +261,7 @@ void tv_list_init_static10(staticList10_T *const sl)
void tv_list_init_static(list_T *const l)
FUNC_ATTR_NONNULL_ALL
{
- memset(l, 0, sizeof(*l));
+ CLEAR_POINTER(l);
l->lv_refcount = DO_NOT_FREE_CNT;
list_log(l, NULL, NULL, "sinit");
}