diff options
author | ZyX <kp-pav@yandex.ru> | 2018-04-10 01:34:54 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2018-04-10 01:52:18 +0300 |
commit | 6f19b9f4e19d12aea23ac61c889aa122bc2576eb (patch) | |
tree | 5ab580094e830ae5495b73057747acbc7a25a62f /src/nvim/eval.c | |
parent | 4d1b3bf317d4827a21d1e4b1aedfacc6e892555b (diff) | |
download | rneovim-6f19b9f4e19d12aea23ac61c889aa122bc2576eb.tar.gz rneovim-6f19b9f4e19d12aea23ac61c889aa122bc2576eb.tar.bz2 rneovim-6f19b9f4e19d12aea23ac61c889aa122bc2576eb.zip |
eval: Silence PVS/V614: use of potentially uninitialized pointer
It is hard to say whether it actually is uninitialized, need to go deeper into
regex code. Probably analyzer did not go that far as regmatch for sure would not
be initialized up until calling NFA/DFA engine functions, which is to be done by
pointer.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4b2e95c624..5281e227d6 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -15627,7 +15627,6 @@ f_spellsuggest_return: static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - regmatch_T regmatch; char_u *save_cpo; int match; colnr_T col = 0; @@ -15660,9 +15659,13 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) return; } - regmatch.regprog = vim_regcomp((char_u *)pat, RE_MAGIC + RE_STRING); + regmatch_T regmatch = { + .regprog = vim_regcomp((char_u *)pat, RE_MAGIC + RE_STRING), + .startp = { NULL }, + .endp = { NULL }, + .rm_ic = false, + }; if (regmatch.regprog != NULL) { - regmatch.rm_ic = FALSE; while (*str != NUL || keepempty) { if (*str == NUL) { match = false; // Empty item at the end. @@ -15681,8 +15684,9 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) && end < (const char *)regmatch.endp[0])) { tv_list_append_string(rettv->vval.v_list, str, end - str); } - if (!match) + if (!match) { break; + } // Advance to just after the match. if (regmatch.endp[0] > (char_u *)str) { col = 0; |