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/spell.c | |
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/spell.c')
-rw-r--r-- | src/nvim/spell.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index ceb35af4b8..64139df689 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -374,7 +374,7 @@ size_t spell_check(win_T *wp, char_u *ptr, hlf_T *attrp, int *capcol, bool docou return 1; } - memset(&mi, 0, sizeof(matchinf_T)); + CLEAR_FIELD(mi); // A number is always OK. Also skip hexadecimal numbers 0xFF99 and // 0X99FF. But always do check spelling to find "3GPP" and "11 @@ -2338,7 +2338,7 @@ theend: // Clear the midword characters for buffer "buf". static void clear_midword(win_T *wp) { - memset(wp->w_s->b_spell_ismw, 0, 256); + CLEAR_FIELD(wp->w_s->b_spell_ismw); XFREE_CLEAR(wp->w_s->b_spell_ismw_mb); } @@ -2610,9 +2610,9 @@ void clear_spell_chartab(spelltab_T *sp) { int i; - // Init everything to false. - memset(sp->st_isw, false, sizeof(sp->st_isw)); - memset(sp->st_isu, false, sizeof(sp->st_isu)); + // Init everything to false (zero). + CLEAR_FIELD(sp->st_isw); + CLEAR_FIELD(sp->st_isu); for (i = 0; i < 256; i++) { sp->st_fold[i] = (char_u)i; @@ -3248,7 +3248,7 @@ static void spell_find_suggest(char_u *badptr, int badlen, suginfo_T *su, int ma bool did_intern = false; // Set the info in "*su". - memset(su, 0, sizeof(suginfo_T)); + CLEAR_POINTER(su); ga_init(&su->su_ga, (int)sizeof(suggest_T), 10); ga_init(&su->su_sga, (int)sizeof(suggest_T), 10); if (*badptr == NUL) { @@ -3760,7 +3760,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so // word). depth = 0; sp = &stack[0]; - memset(sp, 0, sizeof(trystate_T)); // -V512 + CLEAR_POINTER(sp); // -V1068 sp->ts_curi = 1; if (soundfold) { |