eval: fix pvs/V1048

This commit is contained in:
Jan Edmund Lazo 2019-12-22 21:02:49 -05:00
parent 80ebfc304e
commit 33f6c25af8
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
1 changed files with 4 additions and 13 deletions

View File

@ -6626,8 +6626,6 @@ call_func(
error = ERROR_NONE;
executor_call_lua((const char *)funcname, len,
argvars, argcount, rettv);
} else {
error = ERROR_UNKNOWN;
}
} else if (!builtin_function((const char *)rfname, -1)) {
// User defined function.
@ -11797,7 +11795,6 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
case kCdScopeGlobal:
// The global scope never has a local directory
rettv->vval.v_number = 0;
break;
case kCdScopeInvalid:
// We should never get here
@ -11909,16 +11906,12 @@ static void f_histget(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
static void f_histnr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
int i;
const char *const history = tv_get_string_chk(&argvars[0]);
i = history == NULL ? HIST_CMD - 1 : get_histtype(history, strlen(history),
false);
HistoryType i = history == NULL
? HIST_INVALID
: get_histtype(history, strlen(history), false);
if (i != HIST_INVALID) {
i = get_history_idx(i);
} else {
i = -1;
}
rettv->vval.v_number = i;
}
@ -17736,9 +17729,7 @@ static void f_strridx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
if (lastmatch == NULL) {
rettv->vval.v_number = -1;
} else {
if (lastmatch != NULL) {
rettv->vval.v_number = (varnumber_T)(lastmatch - haystack);
}
}