Mercurial > vim
diff src/quickfix.c @ 20007:aadd1cae2ff5 v8.2.0559
patch 8.2.0559: clearing a struct is verbose
Commit: https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 12 19:37:17 2020 +0200
patch 8.2.0559: clearing a struct is verbose
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Apr 2020 19:45:05 +0200 |
parents | 3ff714d765ba |
children | d571231175b4 |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -1667,8 +1667,8 @@ qf_init_ext( // 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)); + CLEAR_FIELD(state); + CLEAR_FIELD(fields); if ((qf_alloc_fields(&fields) == FAIL) || (qf_setup_state(&state, enc, efile, tv, buf, lnumfirst, lnumlast) == FAIL)) @@ -1867,7 +1867,7 @@ qf_new_list(qf_info_T *qi, char_u *qf_ti else qi->qf_curlist = qi->qf_listcount++; qfl = qf_get_curlist(qi); - vim_memset(qfl, 0, (size_t)(sizeof(qf_list_T))); + CLEAR_POINTER(qfl); qf_store_title(qfl, qf_title); qfl->qfl_type = qi->qfl_type; qfl->qf_id = ++last_qf_id; @@ -5794,7 +5794,7 @@ vgr_jump_to_match( { exarg_T ea; - vim_memset(&ea, 0, sizeof(ea)); + CLEAR_FIELD(ea); ea.arg = target_dir; ea.cmdidx = CMD_lcd; ex_cd(&ea); @@ -6151,7 +6151,7 @@ restore_start_dir(char_u *dirname_start) // appropriate ex command and executing it. exarg_T ea; - vim_memset(&ea, 0, sizeof(ea)); + CLEAR_FIELD(ea); ea.arg = dirname_start; ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; ex_cd(&ea);