aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Morales <hel.sheep@gmail.com>2014-09-01 15:34:12 -0400
committerFelipe Morales <hel.sheep@gmail.com>2014-09-04 00:18:25 -0400
commitd860ba45e25231ae54c6fd12ecd00dc936780184 (patch)
treefd0b6b22a5a307f51ea4704d1496b11fcc4f8a8c
parent15d86890d407a6750560088f40104a81fb73b19c (diff)
downloadrneovim-d860ba45e25231ae54c6fd12ecd00dc936780184.tar.gz
rneovim-d860ba45e25231ae54c6fd12ecd00dc936780184.tar.bz2
rneovim-d860ba45e25231ae54c6fd12ecd00dc936780184.zip
vim-patch: 7.4.344
Problem: Unnecessary initializations and other things related to matchaddpos(). Solution: Code cleanup. (Alexey Radkov) https://code.google.com/p/vim/source/detail?r=ce284c205558d103326a4c3f22f181774690b3eb
-rw-r--r--src/nvim/version.c2
-rw-r--r--src/nvim/window.c31
2 files changed, 15 insertions, 18 deletions
diff --git a/src/nvim/version.c b/src/nvim/version.c
index fc8f36621a..8132d5dfcc 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -251,7 +251,7 @@ static int included_patches[] = {
//347,
346,
//345,
- //344,
+ 344,
343,
//342 NA
//341,
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 074e2e6cae..becc21be89 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5242,7 +5242,6 @@ int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos
m->id = id;
m->priority = prio;
m->pattern = pat == NULL ? NULL: vim_strsave(pat);
- m->pos.cur = 0;
m->hlg_id = hlg_id;
m->match.regprog = regprog;
m->match.rmm_ic = FALSE;
@@ -5256,19 +5255,15 @@ int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos
listitem_T *li;
int i;
- for (i = 0, li = pos_list->lv_first; i < MAXPOSMATCH;
+ for (i = 0, li = pos_list->lv_first; li != NULL && i < MAXPOSMATCH;
i++, li = li->li_next) {
- linenr_T lnum = 0;
- colnr_T col = 0;
- int len = 1;
- list_T *subl;
- listitem_T *subli;
- int error = FALSE;
-
- if (li == NULL) {
- m->pos.pos[i].lnum = 0;
- break;
- }
+ linenr_T lnum = 0;
+ colnr_T col = 0;
+ int len = 1;
+ list_T *subl;
+ listitem_T *subli;
+ int error = false;
+
if (li->li_tv.v_type == VAR_LIST) {
subl = li->li_tv.vval.v_list;
if (subl == NULL) {
@@ -5279,18 +5274,18 @@ int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos
goto fail;
}
lnum = get_tv_number_chk(&subli->li_tv, &error);
- if (error == TRUE) {
+ if (error == true) {
goto fail;
}
- m->pos.pos[i].lnum = lnum;
if (lnum == 0) {
--i;
continue;
}
+ m->pos.pos[i].lnum = lnum;
subli = subli->li_next;
if (subli != NULL) {
col = get_tv_number_chk(&subli->li_tv, &error);
- if (error == TRUE)
+ if (error == true)
goto fail;
subli = subli->li_next;
if (subli != NULL) {
@@ -5303,8 +5298,10 @@ int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos
m->pos.pos[i].col = col;
m->pos.pos[i].len = len;
} else if (li->li_tv.v_type == VAR_NUMBER) {
- if (li->li_tv.vval.v_number == 0)
+ if (li->li_tv.vval.v_number == 0) {
+ --i;
continue;
+ }
m->pos.pos[i].lnum = li->li_tv.vval.v_number;
m->pos.pos[i].col = 0;
m->pos.pos[i].len = 0;