From 33f6c25af88ec8de2d45327942f4677d6d6bae4f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 22 Dec 2019 21:02:49 -0500 Subject: eval: fix pvs/V1048 --- src/nvim/eval.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 70fea1c4a9..8749c7d8f0 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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); } } -- cgit