diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-12-22 21:02:49 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-12-22 21:02:49 -0500 |
commit | 33f6c25af88ec8de2d45327942f4677d6d6bae4f (patch) | |
tree | 5012d4dbd8d91742f398aed4d4cecacdf969d218 /src | |
parent | 80ebfc304e295cdb1bed3d0f2781d7884933719a (diff) | |
download | rneovim-33f6c25af88ec8de2d45327942f4677d6d6bae4f.tar.gz rneovim-33f6c25af88ec8de2d45327942f4677d6d6bae4f.tar.bz2 rneovim-33f6c25af88ec8de2d45327942f4677d6d6bae4f.zip |
eval: fix pvs/V1048
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 17 |
1 files changed, 4 insertions, 13 deletions
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); } } |