0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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

@@ -2750,7 +2750,7 @@ push_current_state(int idx)
{
if (ga_grow(&current_state, 1) == FAIL)
return FAIL;
vim_memset(&CUR_STATE(current_state.ga_len), 0, sizeof(stateitem_T));
CLEAR_POINTER(&CUR_STATE(current_state.ga_len));
CUR_STATE(current_state.ga_len).si_idx = idx;
++current_state.ga_len;
return OK;
@@ -4908,7 +4908,7 @@ syn_cmd_match(
// get the pattern.
init_syn_patterns();
vim_memset(&item, 0, sizeof(item));
CLEAR_FIELD(item);
rest = get_syn_pattern(rest, &item);
if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL))
syn_opt_arg.flags |= HL_HAS_EOL;
@@ -5481,7 +5481,7 @@ syn_add_cluster(char_u *name)
return 0;
}
vim_memset(&(SYN_CLSTR(curwin->w_s)[len]), 0, sizeof(syn_cluster_T));
CLEAR_POINTER(&(SYN_CLSTR(curwin->w_s)[len]));
SYN_CLSTR(curwin->w_s)[len].scl_name = name;
SYN_CLSTR(curwin->w_s)[len].scl_name_u = vim_strsave_up(name);
SYN_CLSTR(curwin->w_s)[len].scl_list = NULL;