diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-27 11:52:07 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-27 12:00:52 +0800 |
commit | f586131e578f46165716ac047d6915ef7aa95718 (patch) | |
tree | 36b8d122e71708f7f120a2c17184be25021db591 /src | |
parent | 79872f377019614467a8e03049fb47c067331804 (diff) | |
download | rneovim-f586131e578f46165716ac047d6915ef7aa95718.tar.gz rneovim-f586131e578f46165716ac047d6915ef7aa95718.tar.bz2 rneovim-f586131e578f46165716ac047d6915ef7aa95718.zip |
vim-patch:8.2.4623: Coverity warns for using uninitialized field
Problem: Coverity warns for using uninitialized field.
Solution: Initialize he field to zero.
https://github.com/vim/vim/commit/03a297c63f1512ba9783104a343dc7e2024e0bb0
Also only initialize used fields in f_fullcommand().
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6963ede3ae..ed5c074577 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3271,6 +3271,7 @@ int cmd_exists(const char *const name) // For ":2match" and ":3match" we need to skip the number. ea.cmd = (char *)((*name == '2' || *name == '3') ? name + 1 : name); ea.cmdidx = (cmdidx_T)0; + ea.flags = 0; int full = false; p = find_ex_command(&ea, &full); if (p == NULL) { @@ -3288,6 +3289,7 @@ int cmd_exists(const char *const name) /// "fullcommand" function void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr) { + exarg_T ea; char *name = argvars[0].vval.v_string; rettv->v_type = VAR_STRING; @@ -3301,10 +3303,9 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr) } name = skip_range(name, NULL); - exarg_T ea = { - .cmd = (*name == '2' || *name == '3') ? name + 1 : name, - .cmdidx = (cmdidx_T)0, - }; + ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name; + ea.cmdidx = (cmdidx_T)0; + ea.flags = 0; char *p = find_ex_command(&ea, NULL); if (p == NULL || ea.cmdidx == CMD_SIZE) { return; |