0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -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

@@ -939,14 +939,14 @@ ex_diffupdate(exarg_T *eap) // "eap" can be NULL
goto theend;
// Only use the internal method if it did not fail for one of the buffers.
vim_memset(&diffio, 0, sizeof(diffio));
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.
vim_memset(&diffio, 0, sizeof(diffio));
CLEAR_FIELD(diffio);
diff_try_update(&diffio, idx_orig, eap);
}
@@ -1075,9 +1075,9 @@ diff_file_internal(diffio_T *diffio)
xdemitconf_t emit_cfg;
xdemitcb_t emit_cb;
vim_memset(&param, 0, sizeof(param));
vim_memset(&emit_cfg, 0, sizeof(emit_cfg));
vim_memset(&emit_cb, 0, sizeof(emit_cb));
CLEAR_FIELD(param);
CLEAR_FIELD(emit_cfg);
CLEAR_FIELD(emit_cb);
param.flags = diff_algorithm;