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.
This commit is contained in:
ZyX
2018-04-10 01:34:54 +03:00
parent 4d1b3bf317
commit 6f19b9f4e1

View File

@@ -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;