aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-08-12 14:11:47 +0200
committerGitHub <noreply@github.com>2018-08-12 14:11:47 +0200
commit1211fa09cfd30d6fcd15a897769586d39595a3e8 (patch)
treea6a794c2027a80ebda169559e4e6583621a90819 /src/nvim/eval.c
parentae24c9b27016a841121b1a01664b748b0a5cbeb7 (diff)
parent8ad46a25cb8f774db378f29b0e4c43bce524b76e (diff)
downloadrneovim-1211fa09cfd30d6fcd15a897769586d39595a3e8.tar.gz
rneovim-1211fa09cfd30d6fcd15a897769586d39595a3e8.tar.bz2
rneovim-1211fa09cfd30d6fcd15a897769586d39595a3e8.zip
Merge #8833 from janlazo/vim-8.0.1004
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9765b04922..22cb544f54 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -7603,7 +7603,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char_u *expr = (char_u *)tv_get_string_chk(&argvars[1]);
const char_u *p = argvars[0].vval.v_string;
- if (!error && expr != NULL && p != NULL) {
+ if (!error && expr != NULL && *expr != NUL && p != NULL) {
if (ic) {
const size_t len = STRLEN(expr);
@@ -12227,7 +12227,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
long start = 0;
long nth = 1;
colnr_T startcol = 0;
- int match = 0;
+ bool match = false;
list_T *l = NULL;
listitem_T *li = NULL;
long idx = 0;
@@ -12325,7 +12325,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
for (;; ) {
if (l != NULL) {
if (li == NULL) {
- match = FALSE;
+ match = false;
break;
}
xfree(tofree);
@@ -12351,7 +12351,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
startcol = (colnr_T)(regmatch.startp[0]
+ (*mb_ptr2len)(regmatch.startp[0]) - str);
if (startcol > (colnr_T)len || str + startcol <= regmatch.startp[0]) {
- match = FALSE;
+ match = false;
break;
}
}
@@ -12424,13 +12424,13 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
vim_regfree(regmatch.regprog);
}
- if (type == kSomeMatchStrPos && l == NULL) {
+theend:
+ if (type == kSomeMatchStrPos && l == NULL && rettv->vval.v_list != NULL) {
// matchstrpos() without a list: drop the second item
list_T *const ret_l = rettv->vval.v_list;
tv_list_item_remove(ret_l, TV_LIST_ITEM_NEXT(ret_l, tv_list_first(ret_l)));
}
-theend:
xfree(tofree);
p_cpo = save_cpo;
}