To: vim_dev@googlegroups.com Subject: Patch 7.3.1192 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.1192 Problem: Valgrind reports errors when using backreferences. (Dominique Pelle) Solution: Do not check the end of submatches. Files: src/regexp_nfa.c *** ../vim-7.3.1191/src/regexp_nfa.c 2013-06-14 20:31:20.000000000 +0200 --- src/regexp_nfa.c 2013-06-14 21:09:14.000000000 +0200 *************** *** 3612,3618 **** } /* ! * Return TRUE if "sub1" and "sub2" have the same positions. */ static int sub_equal(sub1, sub2) --- 3612,3618 ---- } /* ! * Return TRUE if "sub1" and "sub2" have the same start positions. */ static int sub_equal(sub1, sub2) *************** *** 3621,3630 **** { int i; int todo; ! linenr_T s1, e1; ! linenr_T s2, e2; ! char_u *sp1, *ep1; ! char_u *sp2, *ep2; todo = sub1->in_use > sub2->in_use ? sub1->in_use : sub2->in_use; if (REG_MULTI) --- 3621,3630 ---- { int i; int todo; ! linenr_T s1; ! linenr_T s2; ! char_u *sp1; ! char_u *sp2; todo = sub1->in_use > sub2->in_use ? sub1->in_use : sub2->in_use; if (REG_MULTI) *************** *** 3632,3664 **** for (i = 0; i < todo; ++i) { if (i < sub1->in_use) - { s1 = sub1->list.multi[i].start.lnum; - e1 = sub1->list.multi[i].end.lnum; - } else - { s1 = 0; - e1 = 0; - } if (i < sub2->in_use) - { s2 = sub2->list.multi[i].start.lnum; - e2 = sub2->list.multi[i].end.lnum; - } else - { s2 = 0; ! e2 = 0; ! } ! if (s1 != s2 || e1 != e2) return FALSE; if (s1 != 0 && sub1->list.multi[i].start.col != sub2->list.multi[i].start.col) return FALSE; - if (e1 != 0 && sub1->list.multi[i].end.col - != sub2->list.multi[i].end.col) - return FALSE; } } else --- 3632,3649 ---- for (i = 0; i < todo; ++i) { if (i < sub1->in_use) s1 = sub1->list.multi[i].start.lnum; else s1 = 0; if (i < sub2->in_use) s2 = sub2->list.multi[i].start.lnum; else s2 = 0; ! if (s1 != s2) return FALSE; if (s1 != 0 && sub1->list.multi[i].start.col != sub2->list.multi[i].start.col) return FALSE; } } else *************** *** 3666,3691 **** for (i = 0; i < todo; ++i) { if (i < sub1->in_use) - { sp1 = sub1->list.line[i].start; - ep1 = sub1->list.line[i].end; - } else - { sp1 = NULL; - ep1 = NULL; - } if (i < sub2->in_use) - { sp2 = sub2->list.line[i].start; - ep2 = sub2->list.line[i].end; - } else - { sp2 = NULL; ! ep2 = NULL; ! } ! if (sp1 != sp2 || ep1 != ep2) return FALSE; } } --- 3651,3664 ---- for (i = 0; i < todo; ++i) { if (i < sub1->in_use) sp1 = sub1->list.line[i].start; else sp1 = NULL; if (i < sub2->in_use) sp2 = sub2->list.line[i].start; else sp2 = NULL; ! if (sp1 != sp2) return FALSE; } } *************** *** 3735,3742 **** if (thread->state->id == state->id && sub_equal(&thread->subs.norm, &subs->norm) #ifdef FEAT_SYN_HL ! && (!nfa_has_zsubexpr || ! sub_equal(&thread->subs.synt, &subs->synt)) #endif ) return TRUE; --- 3708,3715 ---- if (thread->state->id == state->id && sub_equal(&thread->subs.norm, &subs->norm) #ifdef FEAT_SYN_HL ! && (!nfa_has_zsubexpr ! || sub_equal(&thread->subs.synt, &subs->synt)) #endif ) return TRUE; *** ../vim-7.3.1191/src/version.c 2013-06-14 20:31:20.000000000 +0200 --- src/version.c 2013-06-14 21:14:28.000000000 +0200 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 1192, /**/ -- hundred-and-one symptoms of being an internet addict: 202. You're amazed to find out Spam is a food. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///