patch 8.2.0559: clearing a struct is verbose

Problem:    Clearing a struct is verbose.
Solution:   Define and use CLEAR_FIELD() and CLEAR_POINTER().
This commit is contained in:
Bram Moolenaar
2020-04-12 19:37:17 +02:00
parent 82de464f76
commit a80faa8930
55 changed files with 170 additions and 169 deletions

View File

@ -183,7 +183,7 @@ spell_check(
if (wp->w_s->b_langp.ga_len == 0)
return 1;
vim_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
@ -2274,7 +2274,7 @@ theend:
static void
clear_midword(win_T *wp)
{
vim_memset(wp->w_s->b_spell_ismw, 0, 256);
CLEAR_FIELD(wp->w_s->b_spell_ismw);
VIM_CLEAR(wp->w_s->b_spell_ismw_mb);
}
@ -2520,9 +2520,9 @@ clear_spell_chartab(spelltab_T *sp)
{
int i;
// Init everything to FALSE.
vim_memset(sp->st_isw, FALSE, sizeof(sp->st_isw));
vim_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] = i;