Patch 8.2.0559
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
Files: src/vim.h, src/blowfish.c, src/channel.c, src/charset.c,
src/clipboard.c, src/diff.c, src/eval.c, src/evalfunc.c,
src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/findfile.c,
src/gui_gtk_f.c, src/gui_mac.c, src/gui_motif.c, src/gui_w32.c,
src/gui_x11.c, src/hardcopy.c, src/hashtab.c, src/highlight.c,
src/if_mzsch.c, src/insexpand.c, src/kword_test.c, src/list.c,
src/main.c, src/map.c, src/memfile.c, src/message_test.c,
src/misc1.c, src/netbeans.c, src/normal.c, src/ops.c,
src/option.c, src/os_mswin.c, src/os_win32.c, src/popupmenu.c,
src/quickfix.c, src/regexp.c, src/regexp_bt.c, src/regexp_nfa.c,
src/search.c, src/sign.c, src/spell.c, src/spellfile.c,
src/spellsuggest.c, src/syntax.c, src/tag.c, src/terminal.c,
src/time.c, src/undo.c, src/userfunc.c, src/vim9compile.c,
src/vim9execute.c, src/if_py_both.h
*** ../vim-8.2.0558/src/vim.h 2020-04-05 17:07:59.414556253 +0200
--- src/vim.h 2020-04-12 19:28:52.147710424 +0200
***************
*** 1575,1580 ****
--- 1575,1588 ----
#define LALLOC_CLEAR_MULT(type, count) (type *)lalloc_clear(sizeof(type) *
(count), FALSE)
#define LALLOC_MULT(type, count) (type *)lalloc(sizeof(type) * (count),
FALSE)
+ #ifdef HAVE_MEMSET
+ # define vim_memset(ptr, c, size) memset((ptr), (c), (size))
+ #else
+ void *vim_memset(void *, int, size_t);
+ #endif
+ #define CLEAR_FIELD(field) vim_memset(&(field), 0, sizeof(field))
+ #define CLEAR_POINTER(ptr) vim_memset((ptr), 0, sizeof(*(ptr)))
+
/*
* defines to avoid typecasts from (char_u *) to (char *) and back
* (vim_strchr() and vim_strrchr() are now in alloc.c)
***************
*** 1708,1719 ****
#define fnamecmp(x, y) vim_fnamecmp((char_u *)(x), (char_u *)(y))
#define fnamencmp(x, y, n) vim_fnamencmp((char_u *)(x), (char_u *)(y),
(size_t)(n))
- #ifdef HAVE_MEMSET
- # define vim_memset(ptr, c, size) memset((ptr), (c), (size))
- #else
- void *vim_memset(void *, int, size_t);
- #endif
-
#if defined(UNIX) || defined(FEAT_GUI) || defined(VMS) \
|| defined(FEAT_CLIENTSERVER)
# define USE_INPUT_BUF
--- 1716,1721 ----
*** ../vim-8.2.0558/src/blowfish.c 2020-01-23 16:51:58.562062106 +0100
--- src/blowfish.c 2020-04-12 19:20:37.513222562 +0200
***************
*** 514,520 ****
UINT32_T ui = 0xffffffffUL;
bf_state_T state;
! vim_memset(&state, 0, sizeof(bf_state_T));
state.cfb_len = BF_MAX_CFB_LEN;
// We can't simply use sizeof(UINT32_T), it would generate a compiler
--- 514,520 ----
UINT32_T ui = 0xffffffffUL;
bf_state_T state;
! CLEAR_FIELD(state);
state.cfb_len = BF_MAX_CFB_LEN;
// We can't simply use sizeof(UINT32_T), it would generate a compiler
*** ../vim-8.2.0558/src/channel.c 2020-04-12 17:52:49.425492403 +0200
--- src/channel.c 2020-04-12 19:20:55.773163001 +0200
***************
*** 977,983 ****
// Get the server internet address and put into addr structure fill in the
// socket address structure and connect to server.
#ifdef FEAT_IPV6
! vim_memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
# ifdef AI_ADDRCONFIG
--- 977,983 ----
// Get the server internet address and put into addr structure fill in the
// socket address structure and connect to server.
#ifdef FEAT_IPV6
! CLEAR_FIELD(hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
# ifdef AI_ADDRCONFIG
***************
*** 1037,1043 ****
freeaddrinfo(res);
#else
! vim_memset((char *)&server, 0, sizeof(server));
server.sin_family = AF_INET;
server.sin_port = htons(port);
if ((host = gethostbyname(hostname)) == NULL)
--- 1037,1043 ----
freeaddrinfo(res);
#else
! CLEAR_FIELD(server);
server.sin_family = AF_INET;
server.sin_port = htons(port);
if ((host = gethostbyname(hostname)) == NULL)
***************
*** 2514,2520 ****
exarg_T ea;
ch_log(channel, "Executing normal command '%s'", (char *)arg);
! vim_memset(&ea, 0, sizeof(ea));
ea.arg = arg;
ea.addr_count = 0;
ea.forceit = TRUE; // no mapping
--- 2514,2520 ----
exarg_T ea;
ch_log(channel, "Executing normal command '%s'", (char *)arg);
! CLEAR_FIELD(ea);
ea.arg = arg;
ea.addr_count = 0;
ea.forceit = TRUE; // no mapping
***************
*** 2525,2531 ****
exarg_T ea;
ch_log(channel, "redraw");
! vim_memset(&ea, 0, sizeof(ea));
ea.forceit = *arg != NUL;
ex_redraw(&ea);
showruler(FALSE);
--- 2525,2531 ----
exarg_T ea;
ch_log(channel, "redraw");
! CLEAR_FIELD(ea);
ea.forceit = *arg != NUL;
ex_redraw(&ea);
showruler(FALSE);
***************
*** 4793,4799 ****
void
clear_job_options(jobopt_T *opt)
{
! vim_memset(opt, 0, sizeof(jobopt_T));
}
/*
--- 4793,4799 ----
void
clear_job_options(jobopt_T *opt)
{
! CLEAR_POINTER(opt);
}
/*
*** ../vim-8.2.0558/src/charset.c 2020-01-26 21:59:25.620718163 +0100
--- src/charset.c 2020-04-12 18:27:11.701589583 +0200
***************
*** 127,133 ****
/*
* Init word char flags all to FALSE
*/
! vim_memset(buf->b_chartab, 0, (size_t)32);
if (enc_dbcs != 0)
for (c = 0; c < 256; ++c)
{
--- 127,133 ----
/*
* Init word char flags all to FALSE
*/
! CLEAR_FIELD(buf->b_chartab);
if (enc_dbcs != 0)
for (c = 0; c < 256; ++c)
{
*** ../vim-8.2.0558/src/clipboard.c 2020-03-24 21:41:38.027535418 +0100
--- src/clipboard.c 2020-04-12 18:27:15.129581946 +0200
***************
*** 2033,2039 ****
clear_oparg(&oa);
oa.regname = (cbd == &clip_plus ? '+' : '*');
oa.op_type = OP_YANK;
! vim_memset(&ca, 0, sizeof(ca));
ca.oap = &oa;
ca.cmdchar = 'y';
ca.count1 = 1;
--- 2033,2039 ----
clear_oparg(&oa);
oa.regname = (cbd == &clip_plus ? '+' : '*');
oa.op_type = OP_YANK;
! CLEAR_FIELD(ca);
ca.oap = &oa;
ca.cmdchar = 'y';
ca.count1 = 1;
*** ../vim-8.2.0558/src/diff.c 2020-04-02 18:50:42.419773128 +0200
--- src/diff.c 2020-04-12 18:27:21.845566966 +0200
***************
*** 939,952 ****
goto theend;
// Only use the internal method if it did not fail for one of the buffers.
! vim_memset(&diffio, 0, sizeof(diffio));
diffio.dio_internal = diff_internal() && !diff_internal_failed();
diff_try_update(&diffio, idx_orig, eap);
if (diffio.dio_internal && diff_internal_failed())
{
// Internal diff failed, use external diff instead.
! vim_memset(&diffio, 0, sizeof(diffio));
diff_try_update(&diffio, idx_orig, eap);
}
--- 939,952 ----
goto theend;
// Only use the internal method if it did not fail for one of the buffers.
! CLEAR_FIELD(diffio);
diffio.dio_internal = diff_internal() && !diff_internal_failed();
diff_try_update(&diffio, idx_orig, eap);
if (diffio.dio_internal && diff_internal_failed())
{
// Internal diff failed, use external diff instead.
! CLEAR_FIELD(diffio);
diff_try_update(&diffio, idx_orig, eap);
}
***************
*** 1075,1083 ****
xdemitconf_t emit_cfg;
xdemitcb_t emit_cb;
! vim_memset(¶m, 0, sizeof(param));
! vim_memset(&emit_cfg, 0, sizeof(emit_cfg));
! vim_memset(&emit_cb, 0, sizeof(emit_cb));
param.flags = diff_algorithm;
--- 1075,1083 ----
xdemitconf_t emit_cfg;
xdemitcb_t emit_cb;
! CLEAR_FIELD(param);
! CLEAR_FIELD(emit_cfg);
! CLEAR_FIELD(emit_cb);
param.flags = diff_algorithm;
*** ../vim-8.2.0558/src/eval.c 2020-04-05 21:38:11.633962373 +0200
--- src/eval.c 2020-04-12 19:21:25.753065999 +0200
***************
*** 234,240 ****
s = expr->vval.v_string;
if (s == NULL || *s == NUL)
return FAIL;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
return FAIL;
--- 234,240 ----
s = expr->vval.v_string;
if (s == NULL || *s == NUL)
return FAIL;
! CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
return FAIL;
***************
*** 253,259 ****
s = partial_name(partial);
if (s == NULL || *s == NUL)
return FAIL;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
funcexe.partial = partial;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
--- 253,259 ----
s = partial_name(partial);
if (s == NULL || *s == NUL)
return FAIL;
! CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE;
funcexe.partial = partial;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
***************
*** 475,481 ****
funcexe_T funcexe;
rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE;
--- 475,481 ----
funcexe_T funcexe;
rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this
! CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE;
***************
*** 649,655 ****
int quiet = flags & GLV_QUIET;
// Clear everything in "lp".
! vim_memset(lp, 0, sizeof(lval_T));
if (skip)
{
--- 649,655 ----
int quiet = flags & GLV_QUIET;
// Clear everything in "lp".
! CLEAR_POINTER(lp);
if (skip)
{
***************
*** 1715,1721 ****
funcexe_T funcexe;
// Invoke the function.
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate;
--- 1715,1721 ----
funcexe_T funcexe;
// Invoke the function.
! CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate;
***************
*** 2805,2811 ****
else
s = (char_u *)"";
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate;
--- 2805,2811 ----
else
s = (char_u *)"";
! CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate;
***************
*** 5507,5513 ****
init_tv(typval_T *varp)
{
if (varp != NULL)
! vim_memset(varp, 0, sizeof(typval_T));
}
/*
--- 5507,5513 ----
init_tv(typval_T *varp)
{
if (varp != NULL)
! CLEAR_POINTER(varp);
}
/*
*** ../vim-8.2.0558/src/evalfunc.c 2020-04-12 17:52:49.429492390 +0200
--- src/evalfunc.c 2020-04-12 18:27:40.029526298 +0200
***************
*** 2977,2983 ****
pt = argvars[0].vval.v_partial;
else
{
! vim_memset(&fref_pt, 0, sizeof(fref_pt));
fref_pt.pt_name = argvars[0].vval.v_string;
pt = &fref_pt;
}
--- 2977,2983 ----
pt = argvars[0].vval.v_partial;
else
{
! CLEAR_FIELD(fref_pt);
fref_pt.pt_name = argvars[0].vval.v_string;
pt = &fref_pt;
}
***************
*** 6530,6536 ****
}
pos = save_cursor = curwin->w_cursor;
! vim_memset(&sia, 0, sizeof(sia));
sia.sa_stop_lnum = (linenr_T)lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
--- 6530,6536 ----
}
pos = save_cursor = curwin->w_cursor;
! CLEAR_FIELD(sia);
sia.sa_stop_lnum = (linenr_T)lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
***************
*** 6978,6984 ****
{
searchit_arg_T sia;
! vim_memset(&sia, 0, sizeof(sia));
sia.sa_stop_lnum = lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
--- 6978,6984 ----
{
searchit_arg_T sia;
! CLEAR_FIELD(sia);
sia.sa_stop_lnum = lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
***************
*** 8401,8407 ****
lnum = tv_get_lnum(argvars); // -1 on type error
col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
! vim_memset(str, NUL, sizeof(str));
if (rettv_list_alloc(rettv) != FAIL)
{
--- 8401,8407 ----
lnum = tv_get_lnum(argvars); // -1 on type error
col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
! CLEAR_FIELD(str);
if (rettv_list_alloc(rettv) != FAIL)
{
*** ../vim-8.2.0558/src/ex_cmds2.c 2020-04-02 18:50:42.419773128 +0200
--- src/ex_cmds2.c 2020-04-12 18:30:02.949201264 +0200
***************
*** 168,174 ****
// Init ea pseudo-structure, this is needed for the check_overwrite()
// function.
! vim_memset(&ea, 0, sizeof(ea));
if (ret == VIM_YES)
{
--- 168,174 ----
// Init ea pseudo-structure, this is needed for the check_overwrite()
// function.
! CLEAR_FIELD(ea);
if (ret == VIM_YES)
{
***************
*** 889,895 ****
* unobtrusive message.
*/
if (eap == NULL)
! vim_memset(&ex, 0, sizeof(ex));
else
ex = *eap;
ex.arg = fname;
--- 889,895 ----
* unobtrusive message.
*/
if (eap == NULL)
! CLEAR_FIELD(ex);
else
ex = *eap;
ex.arg = fname;
*** ../vim-8.2.0558/src/ex_docmd.c 2020-04-02 21:13:21.392362410 +0200
--- src/ex_docmd.c 2020-04-12 18:31:13.585037641 +0200
***************
*** 728,734 ****
if (flags & DOCMD_EXCRESET)
save_dbg_stuff(&debug_saved);
else
! vim_memset(&debug_saved, 0, sizeof(debug_saved));
initial_trylevel = trylevel;
--- 728,734 ----
if (flags & DOCMD_EXCRESET)
save_dbg_stuff(&debug_saved);
else
! CLEAR_FIELD(debug_saved);
initial_trylevel = trylevel;
***************
*** 1663,1669 ****
int starts_with_colon;
#endif
! vim_memset(&ea, 0, sizeof(ea));
ea.line1 = 1;
ea.line2 = 1;
#ifdef FEAT_EVAL
--- 1663,1669 ----
int starts_with_colon;
#endif
! CLEAR_FIELD(ea);
ea.line1 = 1;
ea.line2 = 1;
#ifdef FEAT_EVAL
***************
*** 2626,2632 ****
{
char_u *p;
! vim_memset(&cmdmod, 0, sizeof(cmdmod));
eap->verbose_save = -1;
eap->save_msg_silent = -1;
--- 2626,2632 ----
{
char_u *p;
! CLEAR_FIELD(cmdmod);
eap->verbose_save = -1;
eap->save_msg_silent = -1;
***************
*** 5631,5637 ****
* Move to the first file.
*/
// Fake up a minimal "next" command for do_argfile()
! vim_memset(&ea, 0, sizeof(ea));
ea.cmd = (char_u *)"next";
do_argfile(&ea, 0);
--- 5631,5637 ----
* Move to the first file.
*/
// Fake up a minimal "next" command for do_argfile()
! CLEAR_FIELD(ea);
ea.cmd = (char_u *)"next";
do_argfile(&ea, 0);
***************
*** 5898,5904 ****
{
exarg_T ea;
! vim_memset(&ea, 0, sizeof(ea));
ea.cmdidx = CMD_tabnew;
ea.cmd = (char_u *)"tabn";
ea.arg = (char_u *)"";
--- 5898,5904 ----
{
exarg_T ea;
! CLEAR_FIELD(ea);
ea.cmdidx = CMD_tabnew;
ea.cmd = (char_u *)"tabn";
ea.arg = (char_u *)"";
*** ../vim-8.2.0558/src/ex_getln.c 2020-04-02 21:13:21.392362410 +0200
--- src/ex_getln.c 2020-04-12 19:21:44.729005115 +0200
***************
*** 218,224 ****
return FALSE;
++emsg_off;
! vim_memset(&ea, 0, sizeof(ea));
ea.line1 = 1;
ea.line2 = 1;
ea.cmd = ccline.cmdbuff;
--- 218,224 ----
return FALSE;
++emsg_off;
! CLEAR_FIELD(ea);
ea.line1 = 1;
ea.line2 = 1;
ea.cmd = ccline.cmdbuff;
***************
*** 459,465 ****
search_flags += SEARCH_START;
ccline.cmdbuff[skiplen + patlen] = NUL;
#ifdef FEAT_RELTIME
! vim_memset(&sia, 0, sizeof(sia));
sia.sa_tm = &tm;
#endif
found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim,
--- 459,465 ----
search_flags += SEARCH_START;
ccline.cmdbuff[skiplen + patlen] = NUL;
#ifdef FEAT_RELTIME
! CLEAR_FIELD(sia);
sia.sa_tm = &tm;
#endif
found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim,
***************
*** 758,764 ****
void
cmdline_init(void)
{
! vim_memset(&ccline, 0, sizeof(cmdline_info_T));
}
/*
--- 758,764 ----
void
cmdline_init(void)
{
! CLEAR_FIELD(ccline);
}
/*
***************
*** 834,840 ****
did_save_ccline = TRUE;
}
if (init_ccline)
! vim_memset(&ccline, 0, sizeof(cmdline_info_T));
#ifdef FEAT_EVAL
if (firstc == -1)
--- 834,840 ----
did_save_ccline = TRUE;
}
if (init_ccline)
! CLEAR_FIELD(ccline);
#ifdef FEAT_EVAL
if (firstc == -1)
***************
*** 2464,2470 ****
did_save_ccline = TRUE;
}
! vim_memset(&ccline, 0, sizeof(cmdline_info_T));
ccline.cmdprompt = prompt;
ccline.cmdattr = attr;
# ifdef FEAT_EVAL
--- 2464,2470 ----
did_save_ccline = TRUE;
}
! CLEAR_FIELD(ccline);
ccline.cmdprompt = prompt;
ccline.cmdattr = attr;
# ifdef FEAT_EVAL
***************
*** 3504,3510 ****
{
if (!prev_ccline_used)
{
! vim_memset(&prev_ccline, 0, sizeof(cmdline_info_T));
prev_ccline_used = TRUE;
}
*ccp = prev_ccline;
--- 3504,3510 ----
{
if (!prev_ccline_used)
{
! CLEAR_FIELD(prev_ccline);
prev_ccline_used = TRUE;
}
*ccp = prev_ccline;
*** ../vim-8.2.0558/src/findfile.c 2019-12-22 15:38:02.350438554 +0100
--- src/findfile.c 2020-04-12 18:34:22.732591928 +0200
***************
*** 320,329 ****
search_ctx = search_ctx_arg;
else
{
! search_ctx = ALLOC_ONE(ff_search_ctx_T);
if (search_ctx == NULL)
goto error_return;
- vim_memset(search_ctx, 0, sizeof(ff_search_ctx_T));
}
search_ctx->ffsc_find_what = find_what;
search_ctx->ffsc_tagfile = tagfile;
--- 320,328 ----
search_ctx = search_ctx_arg;
else
{
! search_ctx = ALLOC_CLEAR_ONE(ff_search_ctx_T);
if (search_ctx == NULL)
goto error_return;
}
search_ctx->ffsc_find_what = find_what;
search_ctx->ffsc_tagfile = tagfile;
*** ../vim-8.2.0558/src/gui_gtk_f.c 2019-12-01 22:03:07.000000000 +0100
--- src/gui_gtk_f.c 2020-04-12 18:34:51.924522371 +0200
***************
*** 223,229 ****
{
GtkTypeInfo form_info;
! vim_memset(&form_info, 0, sizeof(form_info));
form_info.type_name = "GtkForm";
form_info.object_size = sizeof(GtkForm);
form_info.class_size = sizeof(GtkFormClass);
--- 223,229 ----
{
GtkTypeInfo form_info;
! CLEAR_FIELD(form_info);
form_info.type_name = "GtkForm";
form_info.object_size = sizeof(GtkForm);
form_info.class_size = sizeof(GtkFormClass);
*** ../vim-8.2.0558/src/gui_mac.c 2020-01-26 21:59:25.624718145 +0100
--- src/gui_mac.c 2020-04-12 18:35:36.940414756 +0200
***************
*** 5451,5457 ****
button = 0;
// initialize the hotkey mapping
! vim_memset(hotKeys, 0, sizeof(hotKeys));
for (;*buttonChar != 0;)
{
--- 5451,5457 ----
button = 0;
// initialize the hotkey mapping
! CLEAR_FIELD(hotKeys);
for (;*buttonChar != 0;)
{
*** ../vim-8.2.0558/src/gui_motif.c 2020-04-06 22:12:57.137652853 +0200
--- src/gui_motif.c 2020-04-12 18:36:44.648252096 +0200
***************
*** 1956,1962 ****
XmProcessTraversal(w, XmTRAVERSE_CURRENT);
! vim_memset((char *) &keyEvent, 0, sizeof(XKeyPressedEvent));
keyEvent.type = KeyPress;
keyEvent.serial = 1;
keyEvent.send_event = True;
--- 1956,1962 ----
XmProcessTraversal(w, XmTRAVERSE_CURRENT);
! CLEAR_FIELD(keyEvent);
keyEvent.type = KeyPress;
keyEvent.serial = 1;
keyEvent.send_event = True;
*** ../vim-8.2.0558/src/gui_w32.c 2020-04-06 22:12:57.137652853 +0200
--- src/gui_w32.c 2020-04-12 18:37:39.924118666 +0200
***************
*** 3504,3510 ****
// Convert the filter to Windows format.
filterp = convert_filterW(filter);
! vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW));
# ifdef OPENFILENAME_SIZE_VERSION_400W
// be compatible with Windows NT 4.0
fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
--- 3504,3510 ----
// Convert the filter to Windows format.
filterp = convert_filterW(filter);
! CLEAR_FIELD(fileStruct);
# ifdef OPENFILENAME_SIZE_VERSION_400W
// be compatible with Windows NT 4.0
fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
***************
*** 4267,4273 ****
// Mouse hovers over popup window, scroll it if possible.
mouse_row = wp->w_winrow;
mouse_col = wp->w_wincol;
! vim_memset(&cap, 0, sizeof(cap));
cap.arg = zDelta < 0 ? MSCR_UP : MSCR_DOWN;
cap.cmdchar = zDelta < 0 ? K_MOUSEUP : K_MOUSEDOWN;
clear_oparg(&oa);
--- 4267,4273 ----
// Mouse hovers over popup window, scroll it if possible.
mouse_row = wp->w_winrow;
mouse_col = wp->w_wincol;
! CLEAR_FIELD(cap);
cap.arg = zDelta < 0 ? MSCR_UP : MSCR_DOWN;
cap.cmdchar = zDelta < 0 ? K_MOUSEUP : K_MOUSEDOWN;
clear_oparg(&oa);
***************
*** 6478,6484 ****
{
TBBUTTON newtb;
! vim_memset(&newtb, 0, sizeof(newtb));
if (menu_is_separator(menu->name))
{
newtb.iBitmap = 0;
--- 6478,6484 ----
{
TBBUTTON newtb;
! CLEAR_FIELD(newtb);
if (menu_is_separator(menu->name))
{
newtb.iBitmap = 0;
*** ../vim-8.2.0558/src/gui_x11.c 2019-12-02 22:46:51.000000000 +0100
--- src/gui_x11.c 2020-04-12 18:38:06.320054793 +0200
***************
*** 2267,2273 ****
return (guicolor_T)available.pixel;
#endif
colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy));
! vim_memset(&available, 0, sizeof(XColor));
available.red = r << 8;
available.green = g << 8;
available.blue = b << 8;
--- 2267,2273 ----
return (guicolor_T)available.pixel;
#endif
colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy));
! CLEAR_FIELD(available);
available.red = r << 8;
available.green = g << 8;
available.blue = b << 8;
*** ../vim-8.2.0558/src/hardcopy.c 2019-12-04 20:58:33.000000000 +0100
--- src/hardcopy.c 2020-04-12 18:39:19.175884347 +0200
***************
*** 558,564 ****
int page_line;
int jobsplit;
! vim_memset(&settings, 0, sizeof(prt_settings_T));
settings.has_color = TRUE;
# ifdef FEAT_POSTSCRIPT
--- 558,564 ----
int page_line;
int jobsplit;
! CLEAR_FIELD(settings);
settings.has_color = TRUE;
# ifdef FEAT_POSTSCRIPT
***************
*** 681,687 ****
prt_pos_T page_prtpos; // print position at page start
int side;
! vim_memset(&page_prtpos, 0, sizeof(prt_pos_T));
page_prtpos.file_line = eap->line1;
prtpos = page_prtpos;
--- 681,687 ----
prt_pos_T page_prtpos; // print position at page start
int side;
! CLEAR_FIELD(page_prtpos);
page_prtpos.file_line = eap->line1;
prtpos = page_prtpos;
***************
*** 1844,1850 ****
semsg(_("E624: Can't open file \"%s\""), resource->filename);
return FALSE;
}
! vim_memset(prt_resfile.buffer, NUL, PRT_FILE_BUFFER_LEN);
// Parse first line to ensure valid resource file
prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u),
--- 1844,1850 ----
semsg(_("E624: Can't open file \"%s\""), resource->filename);
return FALSE;
}
! CLEAR_FIELD(prt_resfile.buffer);
// Parse first line to ensure valid resource file
prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u),
*** ../vim-8.2.0558/src/hashtab.c 2019-12-04 20:59:07.000000000 +0100
--- src/hashtab.c 2020-04-12 19:21:55.180971726 +0200
***************
*** 65,71 ****
hash_init(hashtab_T *ht)
{
// This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray".
! vim_memset(ht, 0, sizeof(hashtab_T));
ht->ht_array = ht->ht_smallarray;
ht->ht_mask = HT_INIT_SIZE - 1;
}
--- 65,71 ----
hash_init(hashtab_T *ht)
{
// This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray".
! CLEAR_POINTER(ht);
ht->ht_array = ht->ht_smallarray;
ht->ht_mask = HT_INIT_SIZE - 1;
}
***************
*** 394,404 ****
}
else
oldarray = ht->ht_array;
}
else
{
// Allocate an array.
! newarray = ALLOC_MULT(hashitem_T, newsize);
if (newarray == NULL)
{
// Out of memory. When there are NULL items still return OK.
--- 394,405 ----
}
else
oldarray = ht->ht_array;
+ CLEAR_FIELD(ht->ht_smallarray);
}
else
{
// Allocate an array.
! newarray = ALLOC_CLEAR_MULT(hashitem_T, newsize);
if (newarray == NULL)
{
// Out of memory. When there are NULL items still return OK.
***************
*** 411,417 ****
}
oldarray = ht->ht_array;
}
- vim_memset(newarray, 0, (size_t)(sizeof(hashitem_T) * newsize));
/*
* Move all the items from the old array to the new one, placing them in
--- 412,417 ----
*** ../vim-8.2.0558/src/highlight.c 2020-04-02 21:13:21.392362410 +0200
--- src/highlight.c 2020-04-12 19:23:04.980751527 +0200
***************
*** 2141,2147 ****
return 0;
taep = &(((attrentry_T *)table->ga_data)[table->ga_len]);
! vim_memset(taep, 0, sizeof(attrentry_T));
taep->ae_attr = aep->ae_attr;
#ifdef FEAT_GUI
if (table == &gui_attr_table)
--- 2141,2147 ----
return 0;
taep = &(((attrentry_T *)table->ga_data)[table->ga_len]);
! CLEAR_POINTER(taep);
taep->ae_attr = aep->ae_attr;
#ifdef FEAT_GUI
if (table == &gui_attr_table)
***************
*** 2189,2195 ****
{
attrentry_T at_en;
! vim_memset(&at_en, 0, sizeof(attrentry_T));
#ifdef FEAT_TERMGUICOLORS
at_en.ae_u.cterm.fg_rgb = INVALCOLOR;
at_en.ae_u.cterm.bg_rgb = INVALCOLOR;
--- 2189,2195 ----
{
attrentry_T at_en;
! CLEAR_FIELD(at_en);
#ifdef FEAT_TERMGUICOLORS
at_en.ae_u.cterm.fg_rgb = INVALCOLOR;
at_en.ae_u.cterm.bg_rgb = INVALCOLOR;
***************
*** 2211,2217 ****
{
attrentry_T at_en;
! vim_memset(&at_en, 0, sizeof(attrentry_T));
at_en.ae_attr = attr;
if (fg == INVALCOLOR && bg == INVALCOLOR)
{
--- 2211,2217 ----
{
attrentry_T at_en;
! CLEAR_FIELD(at_en);
at_en.ae_attr = attr;
if (fg == INVALCOLOR && bg == INVALCOLOR)
{
***************
*** 2239,2245 ****
{
attrentry_T at_en;
! vim_memset(&at_en, 0, sizeof(attrentry_T));
at_en.ae_attr = attr;
at_en.ae_u.gui.fg_color = fg;
at_en.ae_u.gui.bg_color = bg;
--- 2239,2245 ----
{
attrentry_T at_en;
! CLEAR_FIELD(at_en);
at_en.ae_attr = attr;
at_en.ae_u.gui.fg_color = fg;
at_en.ae_u.gui.bg_color = bg;
***************
*** 2298,2304 ****
new_en = *char_aep;
else
{
! vim_memset(&new_en, 0, sizeof(new_en));
new_en.ae_u.gui.fg_color = INVALCOLOR;
new_en.ae_u.gui.bg_color = INVALCOLOR;
new_en.ae_u.gui.sp_color = INVALCOLOR;
--- 2298,2304 ----
new_en = *char_aep;
else
{
! CLEAR_FIELD(new_en);
new_en.ae_u.gui.fg_color = INVALCOLOR;
new_en.ae_u.gui.bg_color = INVALCOLOR;
new_en.ae_u.gui.sp_color = INVALCOLOR;
***************
*** 2341,2347 ****
new_en = *char_aep;
else
{
! vim_memset(&new_en, 0, sizeof(new_en));
#ifdef FEAT_TERMGUICOLORS
new_en.ae_u.cterm.bg_rgb = INVALCOLOR;
new_en.ae_u.cterm.fg_rgb = INVALCOLOR;
--- 2341,2347 ----
new_en = *char_aep;
else
{
! CLEAR_FIELD(new_en);
#ifdef FEAT_TERMGUICOLORS
new_en.ae_u.cterm.bg_rgb = INVALCOLOR;
new_en.ae_u.cterm.fg_rgb = INVALCOLOR;
***************
*** 2393,2399 ****
new_en = *char_aep;
else
{
! vim_memset(&new_en, 0, sizeof(new_en));
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
--- 2393,2399 ----
new_en = *char_aep;
else
{
! CLEAR_FIELD(new_en);
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
***************
*** 3062,3068 ****
return 0;
}
! vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(hl_group_T));
HL_TABLE()[highlight_ga.ga_len].sg_name = name;
HL_TABLE()[highlight_ga.ga_len].sg_name_u = name_up;
#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
--- 3062,3068 ----
return 0;
}
! CLEAR_POINTER(&(HL_TABLE()[highlight_ga.ga_len]));
HL_TABLE()[highlight_ga.ga_len].sg_name = name;
HL_TABLE()[highlight_ga.ga_len].sg_name_u = name_up;
#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
***************
*** 3262,3268 ****
if (id_alt == 0)
{
! vim_memset(&hlt[hlcnt + i], 0, sizeof(hl_group_T));
hlt[hlcnt + i].sg_term = highlight_attr[hlf];
hlt[hlcnt + i].sg_cterm = highlight_attr[hlf];
# if defined(FEAT_GUI) || defined(FEAT_EVAL)
--- 3262,3268 ----
if (id_alt == 0)
{
! CLEAR_POINTER(&hlt[hlcnt + i]);
hlt[hlcnt + i].sg_term = highlight_attr[hlf];
hlt[hlcnt + i].sg_cterm = highlight_attr[hlf];
# if defined(FEAT_GUI) || defined(FEAT_EVAL)
***************
*** 3457,3463 ****
{
// Make sure id_S is always valid to simplify code below. Use the last
// entry.
! vim_memset(&HL_TABLE()[hlcnt + 27], 0, sizeof(hl_group_T));
HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S];
id_S = hlcnt + 19;
}
--- 3457,3463 ----
{
// Make sure id_S is always valid to simplify code below. Use the last
// entry.
! CLEAR_POINTER(&HL_TABLE()[hlcnt + 27]);
HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S];
id_S = hlcnt + 19;
}
*** ../vim-8.2.0558/src/if_mzsch.c 2020-01-29 21:27:17.578406709 +0100
--- src/if_mzsch.c 2020-04-12 19:23:31.928667715 +0200
***************
*** 1927,1933 ****
MZ_GC_REG();
self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_window));
! vim_memset(self, 0, sizeof(vim_mz_window));
#ifndef MZ_PRECISE_GC
scheme_dont_gc_ptr(self); // because win isn't visible to GC
#else
--- 1927,1933 ----
MZ_GC_REG();
self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_window));
! CLEAR_POINTER(self);
#ifndef MZ_PRECISE_GC
scheme_dont_gc_ptr(self); // because win isn't visible to GC
#else
***************
*** 2311,2317 ****
MZ_GC_REG();
self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_buffer));
! vim_memset(self, 0, sizeof(vim_mz_buffer));
#ifndef MZ_PRECISE_GC
scheme_dont_gc_ptr(self); // because buf isn't visible to GC
#else
--- 2311,2317 ----
MZ_GC_REG();
self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_buffer));
! CLEAR_POINTER(self);
#ifndef MZ_PRECISE_GC
scheme_dont_gc_ptr(self); // because buf isn't visible to GC
#else
***************
*** 2634,2641 ****
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
! array = ALLOC_MULT(char *, new_len + 1);
! vim_memset(array, 0, (new_len+1) * sizeof(char *));
rest = line_list;
for (i = 0; i < new_len; ++i)
--- 2634,2640 ----
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
! array = ALLOC_CLEAR_MULT(char *, new_len + 1);
rest = line_list;
for (i = 0; i < new_len; ++i)
***************
*** 2818,2825 ****
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
! array = ALLOC_MULT(char *, size + 1);
! vim_memset(array, 0, (size+1) * sizeof(char *));
rest = list;
for (i = 0; i < size; ++i)
--- 2817,2823 ----
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
! array = ALLOC_CLEAR_MULT(char *, size + 1);
rest = list;
for (i = 0; i < size; ++i)
*** ../vim-8.2.0558/src/insexpand.c 2020-04-02 18:50:42.423773112 +0200
--- src/insexpand.c 2020-04-12 18:45:48.890957475 +0200
***************
*** 2313,2319 ****
else
{
word = tv_get_string_chk(tv);
! vim_memset(cptext, 0, sizeof(cptext));
}
if (word == NULL || (!empty && *word == NUL))
return FAIL;
--- 2313,2319 ----
else
{
word = tv_get_string_chk(tv);
! CLEAR_FIELD(cptext);
}
if (word == NULL || (!empty && *word == NUL))
return FAIL;
*** ../vim-8.2.0558/src/kword_test.c 2019-12-29 23:04:20.294639884 +0100
--- src/kword_test.c 2020-04-12 18:51:59.610056645 +0200
***************
*** 30,36 ****
buf_T buf;
int c;
! vim_memset(&buf, 0, sizeof(buf));
p_enc = (char_u *)"utf-8";
p_isi = (char_u *)"";
p_isp = (char_u *)"";
--- 30,36 ----
buf_T buf;
int c;
! CLEAR_FIELD(buf);
p_enc = (char_u *)"utf-8";
p_isi = (char_u *)"";
p_isp = (char_u *)"";
*** ../vim-8.2.0558/src/list.c 2020-04-09 21:33:19.166717351 +0200
--- src/list.c 2020-04-12 18:53:01.317905695 +0200
***************
*** 1443,1449 ****
copy_tv(&si2->item->li_tv, &argv[1]);
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
funcexe.partial = partial;
funcexe.selfdict = sortinfo->item_compare_selfdict;
--- 1443,1449 ----
copy_tv(&si2->item->li_tv, &argv[1]);
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
! CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE;
funcexe.partial = partial;
funcexe.selfdict = sortinfo->item_compare_selfdict;
*** ../vim-8.2.0558/src/main.c 2020-04-05 20:20:40.104596563 +0200
--- src/main.c 2020-04-12 18:53:16.813867731 +0200
***************
*** 119,125 ****
// Many variables are in "params" so that we can pass them to invoked
// functions without a lot of arguments. "argc" and "argv" are also
// copied, so that they can be changed.
! vim_memset(¶ms, 0, sizeof(params));
params.argc = argc;
params.argv = argv;
params.want_full_screen = TRUE;
--- 119,125 ----
// Many variables are in "params" so that we can pass them to invoked
// functions without a lot of arguments. "argc" and "argv" are also
// copied, so that they can be changed.
! CLEAR_FIELD(params);
params.argc = argc;
params.argv = argv;
params.want_full_screen = TRUE;
*** ../vim-8.2.0558/src/map.c 2020-04-01 19:22:06.522507242 +0200
--- src/map.c 2020-04-12 18:53:36.589819289 +0200
***************
*** 65,71 ****
{
if (!maphash_valid)
{
! vim_memset(maphash, 0, sizeof(maphash));
maphash_valid = TRUE;
}
}
--- 65,71 ----
{
if (!maphash_valid)
{
! CLEAR_FIELD(maphash);
maphash_valid = TRUE;
}
}
*** ../vim-8.2.0558/src/memfile.c 2019-12-04 21:51:25.000000000 +0100
--- src/memfile.c 2020-04-12 19:23:41.892636878 +0200
***************
*** 1337,1343 ****
static void
mf_hash_init(mf_hashtab_T *mht)
{
! vim_memset(mht, 0, sizeof(mf_hashtab_T));
mht->mht_buckets = mht->mht_small_buckets;
mht->mht_mask = MHT_INIT_SIZE - 1;
}
--- 1337,1343 ----
static void
mf_hash_init(mf_hashtab_T *mht)
{
! CLEAR_POINTER(mht);
mht->mht_buckets = mht->mht_small_buckets;
mht->mht_mask = MHT_INIT_SIZE - 1;
}
***************
*** 1480,1486 ****
* a power of two.
*/
! vim_memset(tails, 0, sizeof(tails));
for (mhi = mht->mht_buckets[i]; mhi != NULL; mhi = mhi->mhi_next)
{
--- 1480,1486 ----
* a power of two.
*/
! CLEAR_FIELD(tails);
for (mhi = mht->mht_buckets[i]; mhi != NULL; mhi = mhi->mhi_next)
{
*** ../vim-8.2.0558/src/message_test.c 2020-02-08 17:14:41.739367277 +0100
--- src/message_test.c 2020-04-12 18:55:32.585534722 +0200
***************
*** 269,275 ****
int
main(int argc, char **argv)
{
! vim_memset(¶ms, 0, sizeof(params));
params.argc = argc;
params.argv = argv;
common_init(¶ms);
--- 269,275 ----
int
main(int argc, char **argv)
{
! CLEAR_FIELD(params);
params.argc = argc;
params.argv = argv;
common_init(¶ms);
*** ../vim-8.2.0558/src/misc1.c 2020-03-20 19:37:26.550539660 +0100
--- src/misc1.c 2020-04-12 18:55:40.157516130 +0200
***************
*** 631,637 ****
{
char_u buf[4];
! vim_memset(buf, 0, sizeof(buf));
if (time_for_testing == 93784)
{
--- 631,637 ----
{
char_u buf[4];
! CLEAR_FIELD(buf);
if (time_for_testing == 93784)
{
*** ../vim-8.2.0558/src/netbeans.c 2020-04-02 18:50:42.423773112 +0200
--- src/netbeans.c 2020-04-12 19:23:54.140599071 +0200
***************
*** 1547,1553 ****
// disappear.
do_bufdel(DOBUF_DEL, (char_u *)"", 1,
buf->bufp->b_fnum, buf->bufp->b_fnum, TRUE);
! vim_memset(buf, 0, sizeof(nbbuf_T));
}
}
// =====================================================================
--- 1547,1553 ----
// disappear.
do_bufdel(DOBUF_DEL, (char_u *)"", 1,
buf->bufp->b_fnum, buf->bufp->b_fnum, TRUE);
! CLEAR_POINTER(buf);
}
}
// =====================================================================
*** ../vim-8.2.0558/src/normal.c 2020-03-16 22:08:42.541514809 +0100
--- src/normal.c 2020-04-12 18:57:14.725283777 +0200
***************
*** 500,506 ****
int set_prevcount = FALSE;
#endif
! vim_memset(&ca, 0, sizeof(ca)); // also resets ca.retval
ca.oap = oap;
// Use a count remembered from before entering an operator. After typing
--- 500,506 ----
int set_prevcount = FALSE;
#endif
! CLEAR_FIELD(ca); // also resets ca.retval
ca.oap = oap;
// Use a count remembered from before entering an operator. After typing
***************
*** 3480,3486 ****
cmdarg_T ca;
clear_oparg(&oa);
! vim_memset(&ca, 0, sizeof(ca));
ca.oap = &oa;
ca.cmdchar = c1;
ca.nchar = c2;
--- 3480,3486 ----
cmdarg_T ca;
clear_oparg(&oa);
! CLEAR_FIELD(ca);
ca.oap = &oa;
ca.cmdchar = c1;
ca.nchar = c2;
***************
*** 4308,4314 ****
cap->oap->use_reg_one = TRUE;
curwin->w_set_curswant = TRUE;
! vim_memset(&sia, 0, sizeof(sia));
i = do_search(cap->oap, dir, dir, pat, cap->count1,
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
if (wrapped != NULL)
--- 4308,4314 ----
cap->oap->use_reg_one = TRUE;
curwin->w_set_curswant = TRUE;
! CLEAR_FIELD(sia);
i = do_search(cap->oap, dir, dir, pat, cap->count1,
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
if (wrapped != NULL)
*** ../vim-8.2.0558/src/ops.c 2020-03-24 21:41:38.027535418 +0100
--- src/ops.c 2020-04-12 19:24:16.848529320 +0200
***************
*** 3412,3418 ****
void
clear_oparg(oparg_T *oap)
{
! vim_memset(oap, 0, sizeof(oparg_T));
}
/*
--- 3412,3418 ----
void
clear_oparg(oparg_T *oap)
{
! CLEAR_POINTER(oap);
}
/*
*** ../vim-8.2.0558/src/option.c 2020-02-15 23:06:40.822770278 +0100
--- src/option.c 2020-04-12 18:58:42.953066726 +0200
***************
*** 1369,1375 ****
}
/*
! * allow '=' and ':' for hystorical reasons (MSDOS command.com
* allows only one '=' character per "set" command line. grrr. (jw)
*/
if (nextchar == '?'
--- 1369,1375 ----
}
/*
! * allow '=' and ':' for historical reasons (MSDOS command.com
* allows only one '=' character per "set" command line. grrr. (jw)
*/
if (nextchar == '?'
***************
*** 5666,5672 ****
if (should_copy || (flags & BCO_ALWAYS))
{
#ifdef FEAT_EVAL
! vim_memset(buf->b_p_script_ctx, 0, sizeof(buf->b_p_script_ctx));
init_buf_opt_idx();
#endif
// Don't copy the options specific to a help buffer when
--- 5666,5672 ----
if (should_copy || (flags & BCO_ALWAYS))
{
#ifdef FEAT_EVAL
! CLEAR_FIELD(buf->b_p_script_ctx);
init_buf_opt_idx();
#endif
// Don't copy the options specific to a help buffer when
*** ../vim-8.2.0558/src/os_mswin.c 2020-01-17 19:32:14.743572013 +0100
--- src/os_mswin.c 2020-04-12 18:59:32.064945776 +0200
***************
*** 1338,1344 ****
int i;
bUserAbort = &(psettings->user_abort);
! vim_memset(&prt_dlg, 0, sizeof(PRINTDLGW));
prt_dlg.lStructSize = sizeof(PRINTDLGW);
# if !defined(FEAT_GUI) || defined(VIMDLL)
# ifdef VIMDLL
--- 1338,1344 ----
int i;
bUserAbort = &(psettings->user_abort);
! CLEAR_FIELD(prt_dlg);
prt_dlg.lStructSize = sizeof(PRINTDLGW);
# if !defined(FEAT_GUI) || defined(VIMDLL)
# ifdef VIMDLL
***************
*** 1467,1473 ****
/*
* Initialise the font according to 'printfont'
*/
! vim_memset(&fLogFont, 0, sizeof(fLogFont));
if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
{
semsg(_("E613: Unknown printer font: %s"), p_pfn);
--- 1467,1473 ----
/*
* Initialise the font according to 'printfont'
*/
! CLEAR_FIELD(fLogFont);
if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
{
semsg(_("E613: Unknown printer font: %s"), p_pfn);
***************
*** 1562,1568 ****
{
DOCINFOW di;
! vim_memset(&di, 0, sizeof(di));
di.cbSize = sizeof(di);
di.lpszDocName = wp;
ret = StartDocW(prt_dlg.hDC, &di);
--- 1562,1568 ----
{
DOCINFOW di;
! CLEAR_FIELD(di);
di.cbSize = sizeof(di);
di.lpszDocName = wp;
ret = StartDocW(prt_dlg.hDC, &di);
***************
*** 2881,2887 ****
# if defined(FEAT_GUI_MSWIN)
CHOOSEFONTW cf;
// if name is "*", bring up std font dialog:
! vim_memset(&cf, 0, sizeof(cf));
cf.lStructSize = sizeof(cf);
cf.hwndOwner = s_hwnd;
cf.Flags = CF_SCREENFONTS | CF_FIXEDPITCHONLY | CF_INITTOLOGFONTSTRUCT;
--- 2881,2887 ----
# if defined(FEAT_GUI_MSWIN)
CHOOSEFONTW cf;
// if name is "*", bring up std font dialog:
! CLEAR_FIELD(cf);
cf.lStructSize = sizeof(cf);
cf.hwndOwner = s_hwnd;
cf.Flags = CF_SCREENFONTS | CF_FIXEDPITCHONLY | CF_INITTOLOGFONTSTRUCT;
*** ../vim-8.2.0558/src/os_win32.c 2020-04-11 22:38:31.501379060 +0200
--- src/os_win32.c 2020-04-12 18:59:47.984906581 +0200
***************
*** 950,956 ****
if (pker->UChar != 0)
return 1;
! vim_memset(abKeystate, 0, sizeof (abKeystate));
// Clear any pending dead keys
ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode,
2, 0);
--- 950,956 ----
if (pker->UChar != 0)
return 1;
! CLEAR_FIELD(abKeystate);
// Clear any pending dead keys
ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode,
2, 0);
*** ../vim-8.2.0558/src/popupmenu.c 2020-04-06 22:12:57.141652839 +0200
--- src/popupmenu.c 2020-04-12 19:00:11.068849674 +0200
***************
*** 1382,1388 ****
FOR_ALL_CHILD_MENUS(menu, mp)
if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
{
! vim_memset(&ea, 0, sizeof(ea));
execute_menu(&ea, mp, -1);
break;
}
--- 1382,1388 ----
FOR_ALL_CHILD_MENUS(menu, mp)
if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
{
! CLEAR_FIELD(ea);
execute_menu(&ea, mp, -1);
break;
}
*** ../vim-8.2.0558/src/quickfix.c 2020-04-06 22:12:57.141652839 +0200
--- src/quickfix.c 2020-04-12 19:24:25.248503617 +0200
***************
*** 1667,1674 ****
// Do not used the cached buffer, it may have been wiped out.
VIM_CLEAR(qf_last_bufname);
! vim_memset(&state, 0, sizeof(state));
! vim_memset(&fields, 0, sizeof(fields));
if ((qf_alloc_fields(&fields) == FAIL) ||
(qf_setup_state(&state, enc, efile, tv, buf,
lnumfirst, lnumlast) == FAIL))
--- 1667,1674 ----
// Do not used the cached buffer, it may have been wiped out.
VIM_CLEAR(qf_last_bufname);
! CLEAR_FIELD(state);
! CLEAR_FIELD(fields);
if ((qf_alloc_fields(&fields) == FAIL) ||
(qf_setup_state(&state, enc, efile, tv, buf,
lnumfirst, lnumlast) == FAIL))
***************
*** 1867,1873 ****
else
qi->qf_curlist = qi->qf_listcount++;
qfl = qf_get_curlist(qi);
! vim_memset(qfl, 0, (size_t)(sizeof(qf_list_T)));
qf_store_title(qfl, qf_title);
qfl->qfl_type = qi->qfl_type;
qfl->qf_id = ++last_qf_id;
--- 1867,1873 ----
else
qi->qf_curlist = qi->qf_listcount++;
qfl = qf_get_curlist(qi);
! CLEAR_POINTER(qfl);
qf_store_title(qfl, qf_title);
qfl->qfl_type = qi->qfl_type;
qfl->qf_id = ++last_qf_id;
***************
*** 5794,5800 ****
{
exarg_T ea;
! vim_memset(&ea, 0, sizeof(ea));
ea.arg = target_dir;
ea.cmdidx = CMD_lcd;
ex_cd(&ea);
--- 5794,5800 ----
{
exarg_T ea;
! CLEAR_FIELD(ea);
ea.arg = target_dir;
ea.cmdidx = CMD_lcd;
ex_cd(&ea);
***************
*** 6151,6157 ****
// appropriate ex command and executing it.
exarg_T ea;
! vim_memset(&ea, 0, sizeof(ea));
ea.arg = dirname_start;
ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd;
ex_cd(&ea);
--- 6151,6157 ----
// appropriate ex command and executing it.
exarg_T ea;
! CLEAR_FIELD(ea);
ea.arg = dirname_start;
ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd;
ex_cd(&ea);
*** ../vim-8.2.0558/src/regexp.c 2020-04-02 21:13:21.388362421 +0200
--- src/regexp.c 2020-04-12 19:02:32.832500099 +0200
***************
*** 2014,2020 ****
argv[0].v_type = VAR_LIST;
argv[0].vval.v_list = &matchList.sl_list;
matchList.sl_list.lv_len = 0;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.argv_func = fill_submatch_list;
funcexe.evaluate = TRUE;
if (expr->v_type == VAR_FUNC)
--- 2014,2020 ----
argv[0].v_type = VAR_LIST;
argv[0].vval.v_list = &matchList.sl_list;
matchList.sl_list.lv_len = 0;
! CLEAR_FIELD(funcexe);
funcexe.argv_func = fill_submatch_list;
funcexe.evaluate = TRUE;
if (expr->v_type == VAR_FUNC)
*** ../vim-8.2.0558/src/regexp_bt.c 2020-02-15 23:06:40.826770264 +0100
--- src/regexp_bt.c 2020-04-12 19:02:43.104474750 +0200
***************
*** 470,476 ****
num_complex_braces = 0;
regnpar = 1;
! vim_memset(had_endbrace, 0, sizeof(had_endbrace));
#ifdef FEAT_SYN_HL
regnzpar = 1;
re_has_z = 0;
--- 470,476 ----
num_complex_braces = 0;
regnpar = 1;
! CLEAR_FIELD(had_endbrace);
#ifdef FEAT_SYN_HL
regnzpar = 1;
re_has_z = 0;
*** ../vim-8.2.0558/src/regexp_nfa.c 2020-02-15 23:06:40.826770264 +0100
--- src/regexp_nfa.c 2020-04-12 19:03:19.692384424 +0200
***************
*** 4564,4570 ****
// avoid compiler warnings
save_ptr = NULL;
! vim_memset(&save_multipos, 0, sizeof(save_multipos));
// Set the position (with "off" added) in the subexpression. Save
// and restore it when it was in use. Otherwise fill any gap.
--- 4564,4570 ----
// avoid compiler warnings
save_ptr = NULL;
! CLEAR_FIELD(save_multipos);
// Set the position (with "off" added) in the subexpression. Save
// and restore it when it was in use. Otherwise fill any gap.
***************
*** 4717,4723 ****
save_ptr = sub->list.line[subidx].end;
sub->list.line[subidx].end = rex.input + off;
// avoid compiler warnings
! vim_memset(&save_multipos, 0, sizeof(save_multipos));
}
subs = addstate(l, state->out, subs, pim, off_arg);
--- 4717,4723 ----
save_ptr = sub->list.line[subidx].end;
sub->list.line[subidx].end = rex.input + off;
// avoid compiler warnings
! CLEAR_FIELD(save_multipos);
}
subs = addstate(l, state->out, subs, pim, off_arg);
*** ../vim-8.2.0558/src/search.c 2020-04-11 21:31:24.045391347 +0200
--- src/search.c 2020-04-12 19:04:11.904255554 +0200
***************
*** 470,476 ****
if (len)
memcpy(lastc_bytes, s, len);
else
! vim_memset(lastc_bytes, 0, sizeof(lastc_bytes));
}
#endif
--- 470,476 ----
if (len)
memcpy(lastc_bytes, s, len);
else
! CLEAR_FIELD(lastc_bytes);
}
#endif
*** ../vim-8.2.0558/src/sign.c 2020-04-02 18:50:42.427773097 +0200
--- src/sign.c 2020-04-12 19:24:34.000476883 +0200
***************
*** 489,495 ****
sign_T *sp;
buf_T *buf = wp->w_buffer;
! vim_memset(sattr, 0, sizeof(sign_attrs_T));
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
--- 489,495 ----
sign_T *sp;
buf_T *buf = wp->w_buffer;
! CLEAR_POINTER(sattr);
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
*** ../vim-8.2.0558/src/spell.c 2020-04-02 18:50:42.427773097 +0200
--- src/spell.c 2020-04-12 19:07:00.079840125 +0200
***************
*** 183,189 ****
if (wp->w_s->b_langp.ga_len == 0)
return 1;
! vim_memset(&mi, 0, sizeof(matchinf_T));
// A number is always OK. Also skip hexadecimal numbers 0xFF99 and
// 0X99FF. But always do check spelling to find "3GPP" and "11
--- 183,189 ----
if (wp->w_s->b_langp.ga_len == 0)
return 1;
! 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,2280 ****
static void
clear_midword(win_T *wp)
{
! vim_memset(wp->w_s->b_spell_ismw, 0, 256);
VIM_CLEAR(wp->w_s->b_spell_ismw_mb);
}
--- 2274,2280 ----
static void
clear_midword(win_T *wp)
{
! CLEAR_FIELD(wp->w_s->b_spell_ismw);
VIM_CLEAR(wp->w_s->b_spell_ismw_mb);
}
***************
*** 2520,2528 ****
{
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));
for (i = 0; i < 256; ++i)
{
sp->st_fold[i] = i;
--- 2520,2528 ----
{
int i;
! // 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;
*** ../vim-8.2.0558/src/spellfile.c 2020-04-02 18:50:42.427773097 +0200
--- src/spellfile.c 2020-04-12 19:24:44.252445654 +0200
***************
*** 4600,4606 ****
{
n = spin->si_first_free;
spin->si_first_free = n->wn_child;
! vim_memset(n, 0, sizeof(wordnode_T));
--spin->si_free_count;
}
#ifdef SPELL_PRINTTREE
--- 4600,4606 ----
{
n = spin->si_first_free;
spin->si_first_free = n->wn_child;
! CLEAR_POINTER(n);
--spin->si_free_count;
}
#ifdef SPELL_PRINTTREE
***************
*** 5886,5892 ****
int error = FALSE;
spellinfo_T spin;
! vim_memset(&spin, 0, sizeof(spin));
spin.si_verbose = !added_word;
spin.si_ascii = ascii;
spin.si_followup = TRUE;
--- 5886,5892 ----
int error = FALSE;
spellinfo_T spin;
! CLEAR_FIELD(spin);
spin.si_verbose = !added_word;
spin.si_ascii = ascii;
spin.si_followup = TRUE;
*** ../vim-8.2.0558/src/spellsuggest.c 2020-04-02 18:50:42.427773097 +0200
--- src/spellsuggest.c 2020-04-12 19:25:00.068397628 +0200
***************
*** 760,766 ****
langp_T *lp;
// Set the info in "*su".
! vim_memset(su, 0, sizeof(suginfo_T));
ga_init2(&su->su_ga, (int)sizeof(suggest_T), 10);
ga_init2(&su->su_sga, (int)sizeof(suggest_T), 10);
if (*badptr == NUL)
--- 760,766 ----
langp_T *lp;
// Set the info in "*su".
! CLEAR_POINTER(su);
ga_init2(&su->su_ga, (int)sizeof(suggest_T), 10);
ga_init2(&su->su_sga, (int)sizeof(suggest_T), 10);
if (*badptr == NUL)
***************
*** 1266,1272 ****
// word).
depth = 0;
sp = &stack[0];
! vim_memset(sp, 0, sizeof(trystate_T));
sp->ts_curi = 1;
if (soundfold)
--- 1266,1272 ----
// word).
depth = 0;
sp = &stack[0];
! CLEAR_POINTER(sp);
sp->ts_curi = 1;
if (soundfold)
*** ../vim-8.2.0558/src/syntax.c 2020-04-06 22:12:57.141652839 +0200
--- src/syntax.c 2020-04-12 19:25:21.416333070 +0200
***************
*** 2750,2756 ****
{
if (ga_grow(¤t_state, 1) == FAIL)
return FAIL;
! vim_memset(&CUR_STATE(current_state.ga_len), 0, sizeof(stateitem_T));
CUR_STATE(current_state.ga_len).si_idx = idx;
++current_state.ga_len;
return OK;
--- 2750,2756 ----
{
if (ga_grow(¤t_state, 1) == FAIL)
return FAIL;
! CLEAR_POINTER(&CUR_STATE(current_state.ga_len));
CUR_STATE(current_state.ga_len).si_idx = idx;
++current_state.ga_len;
return OK;
***************
*** 4908,4914 ****
// get the pattern.
init_syn_patterns();
! vim_memset(&item, 0, sizeof(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;
--- 4908,4914 ----
// get the pattern.
init_syn_patterns();
! 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,5487 ****
return 0;
}
! vim_memset(&(SYN_CLSTR(curwin->w_s)[len]), 0, sizeof(syn_cluster_T));
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;
--- 5481,5487 ----
return 0;
}
! 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;
*** ../vim-8.2.0558/src/tag.c 2020-04-02 21:13:21.396362396 +0200
--- src/tag.c 2020-04-12 19:25:28.904310502 +0200
***************
*** 1753,1759 ****
#ifdef FEAT_TAG_BINS
// This is only to avoid a compiler warning for using search_info
// uninitialised.
! vim_memset(&search_info, 0, (size_t)1);
#endif
#ifdef FEAT_EVAL
--- 1753,1759 ----
#ifdef FEAT_TAG_BINS
// This is only to avoid a compiler warning for using search_info
// uninitialised.
! CLEAR_FIELD(search_info);
#endif
#ifdef FEAT_EVAL
***************
*** 2260,2266 ****
#endif
)
{
! vim_memset(&tagp, 0, sizeof(tagp));
tagp.tagname = lbuf;
tagp.tagname_end = vim_strchr(lbuf, TAB);
if (tagp.tagname_end == NULL)
--- 2260,2266 ----
#endif
)
{
! CLEAR_FIELD(tagp);
tagp.tagname = lbuf;
tagp.tagname_end = vim_strchr(lbuf, TAB);
if (tagp.tagname_end == NULL)
***************
*** 2873,2879 ****
int i;
if (first)
! vim_memset(tnp, 0, sizeof(tagname_T));
if (curbuf->b_help)
{
--- 2873,2879 ----
int i;
if (first)
! CLEAR_POINTER(tnp);
if (curbuf->b_help)
{
*** ../vim-8.2.0558/src/terminal.c 2020-04-02 18:50:42.427773097 +0200
--- src/terminal.c 2020-04-12 19:27:56.295873119 +0200
***************
*** 446,452 ****
ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300);
ga_init2(&term->tl_scrollback_postponed, sizeof(sb_line_T), 300);
! vim_memset(&split_ea, 0, sizeof(split_ea));
if (opt->jo_curwin)
{
// Create a new buffer in the current window.
--- 446,452 ----
ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300);
ga_init2(&term->tl_scrollback_postponed, sizeof(sb_line_T), 300);
! CLEAR_FIELD(split_ea);
if (opt->jo_curwin)
{
// Create a new buffer in the current window.
***************
*** 1756,1762 ****
if (vterm_screen_get_cell(screen, pos, &cell) == 0)
{
width = 1;
! vim_memset(p + pos.col, 0, sizeof(cellattr_T));
if (ga_grow(&ga, 1) == OK)
ga.ga_len += utf_char2bytes(' ',
(char_u *)ga.ga_data + ga.ga_len);
--- 1756,1762 ----
if (vterm_screen_get_cell(screen, pos, &cell) == 0)
{
width = 1;
! CLEAR_POINTER(p + pos.col);
if (ga_grow(&ga, 1) == OK)
ga.ga_len += utf_char2bytes(' ',
(char_u *)ga.ga_data + ga.ga_len);
***************
*** 2243,2249 ****
int id;
guicolor_T term_fg, term_bg;
! vim_memset(&entry, 0, sizeof(entry));
entry.shape = entry.mshape =
term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_UNDERLINE ? SHAPE_HOR :
term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_BAR_LEFT ? SHAPE_VER :
--- 2243,2249 ----
int id;
guicolor_T term_fg, term_bg;
! CLEAR_FIELD(entry);
entry.shape = entry.mshape =
term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_UNDERLINE ? SHAPE_HOR :
term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_BAR_LEFT ? SHAPE_VER :
***************
*** 2781,2787 ****
static void
hl2vtermAttr(int attr, cellattr_T *cell)
{
! vim_memset(&cell->attrs, 0, sizeof(VTermScreenCellAttrs));
if (attr & HL_BOLD)
cell->attrs.bold = 1;
if (attr & HL_UNDERLINE)
--- 2781,2787 ----
static void
hl2vtermAttr(int attr, cellattr_T *cell)
{
! CLEAR_FIELD(cell->attrs);
if (attr & HL_BOLD)
cell->attrs.bold = 1;
if (attr & HL_UNDERLINE)
***************
*** 2919,2925 ****
VTermScreenCellAttrs attr;
int clear_attr;
! vim_memset(&attr, 0, sizeof(attr));
while (for_all_windows_and_curwin(&wp, &did_curwin))
{
--- 2919,2925 ----
VTermScreenCellAttrs attr;
int clear_attr;
! CLEAR_FIELD(attr);
while (for_all_windows_and_curwin(&wp, &did_curwin))
{
***************
*** 3332,3338 ****
{
exarg_T ea;
! vim_memset(&ea, 0, sizeof(ea));
ex_quit(&ea);
return TRUE;
}
--- 3332,3338 ----
{
exarg_T ea;
! CLEAR_FIELD(ea);
ex_quit(&ea);
return TRUE;
}
***************
*** 3502,3508 ****
int c;
if (vterm_screen_get_cell(screen, *pos, &cell) == 0)
! vim_memset(&cell, 0, sizeof(cell));
c = cell.chars[0];
if (c == NUL)
--- 3502,3508 ----
int c;
if (vterm_screen_get_cell(screen, *pos, &cell) == 0)
! CLEAR_FIELD(cell);
c = cell.chars[0];
if (c == NUL)
***************
*** 3828,3834 ****
int fgval, bgval;
int id;
! vim_memset(&term->tl_default_color.attrs, 0,
sizeof(VTermScreenCellAttrs));
term->tl_default_color.width = 1;
fg = &term->tl_default_color.fg;
bg = &term->tl_default_color.bg;
--- 3828,3834 ----
int fgval, bgval;
int id;
! CLEAR_FIELD(term->tl_default_color.attrs);
term->tl_default_color.width = 1;
fg = &term->tl_default_color.fg;
bg = &term->tl_default_color.bg;
***************
*** 4070,4076 ****
}
}
! vim_memset(&ea, 0, sizeof(ea));
if (opt_item != NULL && opt_item->li_tv.v_type == VAR_DICT
&& opt_item->li_tv.vval.v_dict != NULL)
--- 4070,4076 ----
}
}
! CLEAR_FIELD(ea);
if (opt_item != NULL && opt_item->li_tv.v_type == VAR_DICT
&& opt_item->li_tv.vval.v_dict != NULL)
***************
*** 4163,4169 ****
argvars[0].v_type = VAR_NUMBER;
argvars[0].vval.v_number = term->tl_buffer->b_fnum;
argvars[1] = item->li_next->li_tv;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = 1L;
funcexe.lastline = 1L;
funcexe.evaluate = TRUE;
--- 4163,4169 ----
argvars[0].v_type = VAR_NUMBER;
argvars[0].vval.v_number = term->tl_buffer->b_fnum;
argvars[1] = item->li_next->li_tv;
! CLEAR_FIELD(funcexe);
funcexe.firstline = 1L;
funcexe.lastline = 1L;
funcexe.evaluate = TRUE;
***************
*** 4582,4588 ****
return;
}
! vim_memset(&prev_cell, 0, sizeof(prev_cell));
screen = vterm_obtain_screen(term->tl_vterm);
state = vterm_obtain_state(term->tl_vterm);
--- 4582,4588 ----
return;
}
! CLEAR_FIELD(prev_cell);
screen = vterm_obtain_screen(term->tl_vterm);
state = vterm_obtain_state(term->tl_vterm);
***************
*** 4604,4610 ****
&& pos.row == cursor_pos.row);
if (vterm_screen_get_cell(screen, pos, &cell) == 0)
! vim_memset(&cell, 0, sizeof(cell));
for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i)
{
--- 4604,4610 ----
&& pos.row == cursor_pos.row);
if (vterm_screen_get_cell(screen, pos, &cell) == 0)
! CLEAR_FIELD(cell);
for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i)
{
***************
*** 4742,4749 ****
ga_init2(&ga_text, 1, 90);
ga_init2(&ga_cell, sizeof(cellattr_T), 90);
! vim_memset(&cell, 0, sizeof(cell));
! vim_memset(&empty_cell, 0, sizeof(empty_cell));
cursor_pos->row = -1;
cursor_pos->col = -1;
--- 4742,4749 ----
ga_init2(&ga_text, 1, 90);
ga_init2(&ga_cell, sizeof(cellattr_T), 90);
! CLEAR_FIELD(cell);
! CLEAR_FIELD(empty_cell);
cursor_pos->row = -1;
cursor_pos->col = -1;
*** ../vim-8.2.0558/src/time.c 2020-04-06 22:12:57.141652839 +0200
--- src/time.c 2020-04-12 19:12:46.038946432 +0200
***************
*** 313,319 ****
vimconv_T conv;
char_u *enc;
! vim_memset(&tmval, NUL, sizeof(tmval));
fmt = tv_get_string(&argvars[0]);
str = tv_get_string(&argvars[1]);
--- 313,319 ----
vimconv_T conv;
char_u *enc;
! CLEAR_FIELD(tmval);
fmt = tv_get_string(&argvars[0]);
str = tv_get_string(&argvars[1]);
*** ../vim-8.2.0558/src/undo.c 2019-12-05 21:40:57.000000000 +0100
--- src/undo.c 2020-04-12 19:26:06.308198303 +0200
***************
*** 662,668 ****
uep = U_ALLOC_LINE(sizeof(u_entry_T));
if (uep == NULL)
goto nomem;
! vim_memset(uep, 0, sizeof(u_entry_T));
#ifdef U_DEBUG
uep->ue_magic = UE_MAGIC;
#endif
--- 662,668 ----
uep = U_ALLOC_LINE(sizeof(u_entry_T));
if (uep == NULL)
goto nomem;
! CLEAR_POINTER(uep);
#ifdef U_DEBUG
uep->ue_magic = UE_MAGIC;
#endif
***************
*** 1288,1294 ****
uhp = U_ALLOC_LINE(sizeof(u_header_T));
if (uhp == NULL)
return NULL;
! vim_memset(uhp, 0, sizeof(u_header_T));
#ifdef U_DEBUG
uhp->uh_magic = UH_MAGIC;
#endif
--- 1288,1294 ----
uhp = U_ALLOC_LINE(sizeof(u_header_T));
if (uhp == NULL)
return NULL;
! CLEAR_POINTER(uhp);
#ifdef U_DEBUG
uhp->uh_magic = UH_MAGIC;
#endif
***************
*** 1405,1411 ****
uep = U_ALLOC_LINE(sizeof(u_entry_T));
if (uep == NULL)
return NULL;
! vim_memset(uep, 0, sizeof(u_entry_T));
#ifdef U_DEBUG
uep->ue_magic = UE_MAGIC;
#endif
--- 1405,1411 ----
uep = U_ALLOC_LINE(sizeof(u_entry_T));
if (uep == NULL)
return NULL;
! CLEAR_POINTER(uep);
#ifdef U_DEBUG
uep->ue_magic = UE_MAGIC;
#endif
***************
*** 1532,1538 ****
#endif
bufinfo_T bi;
! vim_memset(&bi, 0, sizeof(bi));
if (name == NULL)
{
--- 1532,1538 ----
#endif
bufinfo_T bi;
! CLEAR_FIELD(bi);
if (name == NULL)
{
***************
*** 1814,1820 ****
#endif
bufinfo_T bi;
! vim_memset(&bi, 0, sizeof(bi));
line_ptr.ul_len = 0;
line_ptr.ul_line = NULL;
--- 1814,1820 ----
#endif
bufinfo_T bi;
! CLEAR_FIELD(bi);
line_ptr.ul_len = 0;
line_ptr.ul_line = NULL;
*** ../vim-8.2.0558/src/userfunc.c 2020-04-07 22:44:56.778289142 +0200
--- src/userfunc.c 2020-04-12 19:18:04.449738439 +0200
***************
*** 1136,1142 ****
v->di_tv.v_lock = VAR_FIXED;
v->di_tv.vval.v_list = &fc->l_varlist;
}
! vim_memset(&fc->l_varlist, 0, sizeof(list_T));
fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
fc->l_varlist.lv_lock = VAR_FIXED;
--- 1136,1142 ----
v->di_tv.v_lock = VAR_FIXED;
v->di_tv.vval.v_list = &fc->l_varlist;
}
! CLEAR_FIELD(fc->l_varlist);
fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
fc->l_varlist.lv_lock = VAR_FIXED;
***************
*** 1659,1665 ****
{
funcexe_T funcexe;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE;
--- 1659,1665 ----
{
funcexe_T funcexe;
! CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE;
***************
*** 1698,1704 ****
funcexe_T funcexe;
int ret;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
funcexe.partial = callback->cb_partial;
++callback_depth;
--- 1698,1704 ----
funcexe_T funcexe;
int ret;
! CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE;
funcexe.partial = callback->cb_partial;
++callback_depth;
***************
*** 2052,2058 ****
int vim9script;
if (fdp != NULL)
! vim_memset(fdp, 0, sizeof(funcdict_T));
start = *pp;
// Check for hard coded <SNR>: already translated function ID (from a user
--- 2052,2058 ----
int vim9script;
if (fdp != NULL)
! CLEAR_POINTER(fdp);
start = *pp;
// Check for hard coded <SNR>: already translated function ID (from a user
***************
*** 3572,3578 ****
}
arg = startarg;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = eap->line1;
funcexe.lastline = eap->line2;
funcexe.doesrange = &doesrange;
--- 3572,3578 ----
}
arg = startarg;
! CLEAR_FIELD(funcexe);
funcexe.firstline = eap->line1;
funcexe.lastline = eap->line2;
funcexe.doesrange = &doesrange;
*** ../vim-8.2.0558/src/vim9compile.c 2020-04-12 18:02:02.031541127 +0200
--- src/vim9compile.c 2020-04-12 19:18:38.021622493 +0200
***************
*** 5617,5623 ****
if (ga_grow(&def_functions, 1) == FAIL)
return;
dfunc = ((dfunc_T *)def_functions.ga_data) + def_functions.ga_len;
! vim_memset(dfunc, 0, sizeof(dfunc_T));
dfunc->df_idx = def_functions.ga_len;
ufunc->uf_dfunc_idx = dfunc->df_idx;
dfunc->df_ufunc = ufunc;
--- 5617,5623 ----
if (ga_grow(&def_functions, 1) == FAIL)
return;
dfunc = ((dfunc_T *)def_functions.ga_data) + def_functions.ga_len;
! CLEAR_POINTER(dfunc);
dfunc->df_idx = def_functions.ga_len;
ufunc->uf_dfunc_idx = dfunc->df_idx;
dfunc->df_ufunc = ufunc;
***************
*** 5625,5631 ****
}
}
! vim_memset(&cctx, 0, sizeof(cctx));
cctx.ctx_ufunc = ufunc;
cctx.ctx_lnum = -1;
ga_init2(&cctx.ctx_locals, sizeof(lvar_T), 10);
--- 5625,5631 ----
}
}
! CLEAR_FIELD(cctx);
cctx.ctx_ufunc = ufunc;
cctx.ctx_lnum = -1;
ga_init2(&cctx.ctx_locals, sizeof(lvar_T), 10);
***************
*** 5713,5719 ****
emsg_before = called_emsg;
had_return = FALSE;
! vim_memset(&ea, 0, sizeof(ea));
ea.cmdlinep = &line;
ea.cmd = skipwhite(line);
--- 5713,5719 ----
emsg_before = called_emsg;
had_return = FALSE;
! CLEAR_FIELD(ea);
ea.cmdlinep = &line;
ea.cmd = skipwhite(line);
*** ../vim-8.2.0558/src/vim9execute.c 2020-04-11 22:31:24.058346869 +0200
--- src/vim9execute.c 2020-04-12 19:18:53.017571246 +0200
***************
*** 358,364 ****
if (call_prepare(argcount, argvars, ectx) == FAIL)
return FAIL;
! vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
// Call the user function. Result goes in last position on the stack.
--- 358,364 ----
if (call_prepare(argcount, argvars, ectx) == FAIL)
return FAIL;
! CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE;
// Call the user function. Result goes in last position on the stack.
***************
*** 498,504 ****
// Get pointer to a local variable on the stack. Negative for arguments.
#define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) +
ectx.ec_frame + STACK_FRAME_SIZE + idx)
! vim_memset(&ectx, 0, sizeof(ectx));
ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
if (ga_grow(&ectx.ec_stack, 20) == FAIL)
return FAIL;
--- 498,504 ----
// Get pointer to a local variable on the stack. Negative for arguments.
#define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) +
ectx.ec_frame + STACK_FRAME_SIZE + idx)
! CLEAR_FIELD(ectx);
ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
if (ga_grow(&ectx.ec_stack, 20) == FAIL)
return FAIL;
*** ../vim-8.2.0558/src/if_py_both.h 2020-04-05 21:38:11.637962358 +0200
--- src/if_py_both.h 2020-04-12 19:20:04.449331393 +0200
***************
*** 3200,3206 ****
if (self->argv || self->self)
{
! vim_memset(&pt, 0, sizeof(partial_T));
set_partial(self, &pt, FALSE);
pt_ptr = &pt;
}
--- 3200,3206 ----
if (self->argv || self->self)
{
! CLEAR_FIELD(pt);
set_partial(self, &pt, FALSE);
pt_ptr = &pt;
}
***************
*** 6420,6426 ****
static void
init_structs(void)
{
! vim_memset(&OutputType, 0, sizeof(OutputType));
OutputType.tp_name = "vim.message";
OutputType.tp_basicsize = sizeof(OutputObject);
OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
--- 6420,6426 ----
static void
init_structs(void)
{
! CLEAR_FIELD(OutputType);
OutputType.tp_name = "vim.message";
OutputType.tp_basicsize = sizeof(OutputObject);
OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
***************
*** 6440,6446 ****
// OutputType.tp_base = &PyFile_Type;
#endif
! vim_memset(&IterType, 0, sizeof(IterType));
IterType.tp_name = "vim.iter";
IterType.tp_basicsize = sizeof(IterObject);
IterType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
--- 6440,6446 ----
// OutputType.tp_base = &PyFile_Type;
#endif
! CLEAR_FIELD(IterType);
IterType.tp_name = "vim.iter";
IterType.tp_basicsize = sizeof(IterObject);
IterType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
***************
*** 6451,6457 ****
IterType.tp_traverse = (traverseproc)IterTraverse;
IterType.tp_clear = (inquiry)IterClear;
! vim_memset(&BufferType, 0, sizeof(BufferType));
BufferType.tp_name = "vim.buffer";
BufferType.tp_basicsize = sizeof(BufferType);
BufferType.tp_dealloc = (destructor)BufferDestructor;
--- 6451,6457 ----
IterType.tp_traverse = (traverseproc)IterTraverse;
IterType.tp_clear = (inquiry)IterClear;
! CLEAR_FIELD(BufferType);
BufferType.tp_name = "vim.buffer";
BufferType.tp_basicsize = sizeof(BufferType);
BufferType.tp_dealloc = (destructor)BufferDestructor;
***************
*** 6472,6478 ****
BufferType.tp_setattr = (setattrfunc)BufferSetattr;
#endif
! vim_memset(&WindowType, 0, sizeof(WindowType));
WindowType.tp_name = "vim.window";
WindowType.tp_basicsize = sizeof(WindowObject);
WindowType.tp_dealloc = (destructor)WindowDestructor;
--- 6472,6478 ----
BufferType.tp_setattr = (setattrfunc)BufferSetattr;
#endif
! CLEAR_FIELD(WindowType);
WindowType.tp_name = "vim.window";
WindowType.tp_basicsize = sizeof(WindowObject);
WindowType.tp_dealloc = (destructor)WindowDestructor;
***************
*** 6493,6499 ****
WindowType.tp_setattr = (setattrfunc)WindowSetattr;
#endif
! vim_memset(&TabPageType, 0, sizeof(TabPageType));
TabPageType.tp_name = "vim.tabpage";
TabPageType.tp_basicsize = sizeof(TabPageObject);
TabPageType.tp_dealloc = (destructor)TabPageDestructor;
--- 6493,6499 ----
WindowType.tp_setattr = (setattrfunc)WindowSetattr;
#endif
! CLEAR_FIELD(TabPageType);
TabPageType.tp_name = "vim.tabpage";
TabPageType.tp_basicsize = sizeof(TabPageObject);
TabPageType.tp_dealloc = (destructor)TabPageDestructor;
***************
*** 6510,6516 ****
TabPageType.tp_getattr = (getattrfunc)TabPageGetattr;
#endif
! vim_memset(&BufMapType, 0, sizeof(BufMapType));
BufMapType.tp_name = "vim.bufferlist";
BufMapType.tp_basicsize = sizeof(BufMapObject);
BufMapType.tp_as_mapping = &BufMapAsMapping;
--- 6510,6516 ----
TabPageType.tp_getattr = (getattrfunc)TabPageGetattr;
#endif
! CLEAR_FIELD(BufMapType);
BufMapType.tp_name = "vim.bufferlist";
BufMapType.tp_basicsize = sizeof(BufMapObject);
BufMapType.tp_as_mapping = &BufMapAsMapping;
***************
*** 6518,6524 ****
BufMapType.tp_iter = BufMapIter;
BufferType.tp_doc = "vim buffer list";
! vim_memset(&WinListType, 0, sizeof(WinListType));
WinListType.tp_name = "vim.windowlist";
WinListType.tp_basicsize = sizeof(WinListType);
WinListType.tp_as_sequence = &WinListAsSeq;
--- 6518,6524 ----
BufMapType.tp_iter = BufMapIter;
BufferType.tp_doc = "vim buffer list";
! CLEAR_FIELD(WinListType);
WinListType.tp_name = "vim.windowlist";
WinListType.tp_basicsize = sizeof(WinListType);
WinListType.tp_as_sequence = &WinListAsSeq;
***************
*** 6526,6539 ****
WinListType.tp_doc = "vim window list";
WinListType.tp_dealloc = (destructor)WinListDestructor;
! vim_memset(&TabListType, 0, sizeof(TabListType));
TabListType.tp_name = "vim.tabpagelist";
TabListType.tp_basicsize = sizeof(TabListType);
TabListType.tp_as_sequence = &TabListAsSeq;
TabListType.tp_flags = Py_TPFLAGS_DEFAULT;
TabListType.tp_doc = "vim tab page list";
! vim_memset(&RangeType, 0, sizeof(RangeType));
RangeType.tp_name = "vim.range";
RangeType.tp_basicsize = sizeof(RangeObject);
RangeType.tp_dealloc = (destructor)RangeDestructor;
--- 6526,6539 ----
WinListType.tp_doc = "vim window list";
WinListType.tp_dealloc = (destructor)WinListDestructor;
! CLEAR_FIELD(TabListType);
TabListType.tp_name = "vim.tabpagelist";
TabListType.tp_basicsize = sizeof(TabListType);
TabListType.tp_as_sequence = &TabListAsSeq;
TabListType.tp_flags = Py_TPFLAGS_DEFAULT;
TabListType.tp_doc = "vim tab page list";
! CLEAR_FIELD(RangeType);
RangeType.tp_name = "vim.range";
RangeType.tp_basicsize = sizeof(RangeObject);
RangeType.tp_dealloc = (destructor)RangeDestructor;
***************
*** 6554,6560 ****
RangeType.tp_getattr = (getattrfunc)RangeGetattr;
#endif
! vim_memset(&CurrentType, 0, sizeof(CurrentType));
CurrentType.tp_name = "vim.currentdata";
CurrentType.tp_basicsize = sizeof(CurrentObject);
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
--- 6554,6560 ----
RangeType.tp_getattr = (getattrfunc)RangeGetattr;
#endif
! CLEAR_FIELD(CurrentType);
CurrentType.tp_name = "vim.currentdata";
CurrentType.tp_basicsize = sizeof(CurrentObject);
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
***************
*** 6568,6574 ****
CurrentType.tp_setattr = (setattrfunc)CurrentSetattr;
#endif
! vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
DictionaryType.tp_name = "vim.dictionary";
DictionaryType.tp_basicsize = sizeof(DictionaryObject);
DictionaryType.tp_dealloc = (destructor)DictionaryDestructor;
--- 6568,6574 ----
CurrentType.tp_setattr = (setattrfunc)CurrentSetattr;
#endif
! CLEAR_FIELD(DictionaryType);
DictionaryType.tp_name = "vim.dictionary";
DictionaryType.tp_basicsize = sizeof(DictionaryObject);
DictionaryType.tp_dealloc = (destructor)DictionaryDestructor;
***************
*** 6588,6594 ****
DictionaryType.tp_setattr = (setattrfunc)DictionarySetattr;
#endif
! vim_memset(&ListType, 0, sizeof(ListType));
ListType.tp_name = "vim.list";
ListType.tp_dealloc = (destructor)ListDestructor;
ListType.tp_basicsize = sizeof(ListObject);
--- 6588,6594 ----
DictionaryType.tp_setattr = (setattrfunc)DictionarySetattr;
#endif
! CLEAR_FIELD(ListType);
ListType.tp_name = "vim.list";
ListType.tp_dealloc = (destructor)ListDestructor;
ListType.tp_basicsize = sizeof(ListObject);
***************
*** 6608,6614 ****
ListType.tp_setattr = (setattrfunc)ListSetattr;
#endif
! vim_memset(&FunctionType, 0, sizeof(FunctionType));
FunctionType.tp_name = "vim.function";
FunctionType.tp_basicsize = sizeof(FunctionObject);
FunctionType.tp_dealloc = (destructor)FunctionDestructor;
--- 6608,6614 ----
ListType.tp_setattr = (setattrfunc)ListSetattr;
#endif
! CLEAR_FIELD(FunctionType);
FunctionType.tp_name = "vim.function";
FunctionType.tp_basicsize = sizeof(FunctionObject);
FunctionType.tp_dealloc = (destructor)FunctionDestructor;
***************
*** 6625,6631 ****
FunctionType.tp_getattr = (getattrfunc)FunctionGetattr;
#endif
! vim_memset(&OptionsType, 0, sizeof(OptionsType));
OptionsType.tp_name = "vim.options";
OptionsType.tp_basicsize = sizeof(OptionsObject);
OptionsType.tp_as_sequence = &OptionsAsSeq;
--- 6625,6631 ----
FunctionType.tp_getattr = (getattrfunc)FunctionGetattr;
#endif
! CLEAR_FIELD(OptionsType);
OptionsType.tp_name = "vim.options";
OptionsType.tp_basicsize = sizeof(OptionsObject);
OptionsType.tp_as_sequence = &OptionsAsSeq;
***************
*** 6638,6644 ****
OptionsType.tp_clear = (inquiry)OptionsClear;
#if PY_VERSION_HEX < 0x030700f0
! vim_memset(&LoaderType, 0, sizeof(LoaderType));
LoaderType.tp_name = "vim.Loader";
LoaderType.tp_basicsize = sizeof(LoaderObject);
LoaderType.tp_flags = Py_TPFLAGS_DEFAULT;
--- 6638,6644 ----
OptionsType.tp_clear = (inquiry)OptionsClear;
#if PY_VERSION_HEX < 0x030700f0
! CLEAR_FIELD(LoaderType);
LoaderType.tp_name = "vim.Loader";
LoaderType.tp_basicsize = sizeof(LoaderObject);
LoaderType.tp_flags = Py_TPFLAGS_DEFAULT;
***************
*** 6648,6654 ****
#endif
#if PY_MAJOR_VERSION >= 3
! vim_memset(&vimmodule, 0, sizeof(vimmodule));
vimmodule.m_name = "vim";
vimmodule.m_doc = "Vim Python interface\n";
vimmodule.m_size = -1;
--- 6648,6654 ----
#endif
#if PY_MAJOR_VERSION >= 3
! CLEAR_FIELD(vimmodule);
vimmodule.m_name = "vim";
vimmodule.m_doc = "Vim Python interface\n";
vimmodule.m_size = -1;
*** ../vim-8.2.0558/src/version.c 2020-04-12 18:02:02.031541127 +0200
--- src/version.c 2020-04-12 19:33:14.778961661 +0200
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 559,
/**/
--
To keep milk from turning sour: Keep it in the cow.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202004121737.03CHbpdm032499%40masaka.moolenaar.net.