aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.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/normal.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/normal.c')
-rw-r--r--src/nvim/normal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 064b73a56f..1657b391d0 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -466,7 +466,7 @@ void normal_enter(bool cmdwin, bool noexmode)
static void normal_prepare(NormalState *s)
{
- memset(&s->ca, 0, sizeof(s->ca)); // also resets ca.retval
+ CLEAR_FIELD(s->ca); // also resets s->ca.retval
s->ca.oap = &s->oa;
// Use a count remembered from before entering an operator. After typing "3d"
@@ -4149,7 +4149,7 @@ void do_nv_ident(int c1, int c2)
cmdarg_T ca;
clear_oparg(&oa);
- memset(&ca, 0, sizeof(ca));
+ CLEAR_FIELD(ca);
ca.oap = &oa;
ca.cmdchar = c1;
ca.nchar = c2;
@@ -4845,7 +4845,7 @@ static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrap
cap->oap->use_reg_one = true;
curwin->w_set_curswant = true;
- memset(&sia, 0, sizeof(sia));
+ CLEAR_FIELD(sia);
i = do_search(cap->oap, dir, dir, pat, cap->count1,
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
if (wrapped != NULL) {