eval: fix pvs/V1048

This commit is contained in:
Jan Edmund Lazo
2019-12-22 21:02:49 -05:00
parent 80ebfc304e
commit 33f6c25af8

View File

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