|
Karsten Hopp |
ae61a4 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
ae61a4 |
Subject: Patch 7.3.990
|
|
Karsten Hopp |
ae61a4 |
Fcc: outbox
|
|
Karsten Hopp |
ae61a4 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
ae61a4 |
Mime-Version: 1.0
|
|
Karsten Hopp |
ae61a4 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
ae61a4 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
ae61a4 |
------------
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
Patch 7.3.990
|
|
Karsten Hopp |
ae61a4 |
Problem: Memory leak in new regexp engine.
|
|
Karsten Hopp |
ae61a4 |
Solution: Jump to end of function to free memory. (Dominique Pelle)
|
|
Karsten Hopp |
ae61a4 |
Files: src/regexp_nfa.c
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
*** ../vim-7.3.989/src/regexp_nfa.c 2013-05-21 15:33:37.000000000 +0200
|
|
Karsten Hopp |
ae61a4 |
--- src/regexp_nfa.c 2013-05-21 16:17:15.000000000 +0200
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2143,2148 ****
|
|
Karsten Hopp |
ae61a4 |
--- 2143,2149 ----
|
|
Karsten Hopp |
ae61a4 |
nfa_state_T *s;
|
|
Karsten Hopp |
ae61a4 |
nfa_state_T *s1;
|
|
Karsten Hopp |
ae61a4 |
nfa_state_T *matchstate;
|
|
Karsten Hopp |
ae61a4 |
+ nfa_state_T *ret = NULL;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
if (postfix == NULL)
|
|
Karsten Hopp |
ae61a4 |
return NULL;
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2211,2217 ****
|
|
Karsten Hopp |
ae61a4 |
e1 = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e1.start, e2.start);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e1.out, e2.out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2212,2218 ----
|
|
Karsten Hopp |
ae61a4 |
e1 = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e1.start, e2.start);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e1.out, e2.out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2225,2231 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out1)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
--- 2226,2232 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out1)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2240,2246 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e.out, list1(&s->out1))));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2241,2247 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e.out, list1(&s->out1))));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2254,2260 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, NULL, e.start);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e.out, list1(&s->out))));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2255,2261 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, NULL, e.start);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, append(e.out, list1(&s->out))));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2268,2274 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(e.start, list1(&s->out1)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
--- 2269,2275 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SPLIT, e.start, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(e.start, list1(&s->out1)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2283,2289 ****
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SKIP_CHAR, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2284,2290 ----
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_SKIP_CHAR, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2293,2299 ****
|
|
Karsten Hopp |
ae61a4 |
* END_INVISIBLE, similarly to MOPEN.
|
|
Karsten Hopp |
ae61a4 |
*/
|
|
Karsten Hopp |
ae61a4 |
/* TODO: Maybe this drops the speed? */
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
--- 2294,2300 ----
|
|
Karsten Hopp |
ae61a4 |
* END_INVISIBLE, similarly to MOPEN.
|
|
Karsten Hopp |
ae61a4 |
*/
|
|
Karsten Hopp |
ae61a4 |
/* TODO: Maybe this drops the speed? */
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2303,2314 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(NFA_END_INVISIBLE, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s1);
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_START_INVISIBLE, e.start, s1);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2304,2315 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(NFA_END_INVISIBLE, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s1);
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
s = new_state(NFA_START_INVISIBLE, e.start, s1);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2357,2366 ****
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
s = new_state(mopen, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(mclose, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
patch(list1(&s->out), s1);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
--- 2358,2367 ----
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
s = new_state(mopen, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(mclose, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
patch(list1(&s->out), s1);
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2371,2381 ****
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(mopen, e.start, NULL); /* `(' */
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(mclose, NULL, NULL); /* `)' */
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s1);
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
if (mopen == NFA_MULTIBYTE || mopen == NFA_COMPOSING)
|
|
Karsten Hopp |
ae61a4 |
--- 2372,2382 ----
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
s = new_state(mopen, e.start, NULL); /* `(' */
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
s1 = new_state(mclose, NULL, NULL); /* `)' */
|
|
Karsten Hopp |
ae61a4 |
if (s1 == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, s1);
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
if (mopen == NFA_MULTIBYTE || mopen == NFA_COMPOSING)
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2397,2403 ****
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
s = new_state(*p, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! return NULL;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--- 2398,2404 ----
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
s = new_state(*p, NULL, NULL);
|
|
Karsten Hopp |
ae61a4 |
if (s == NULL)
|
|
Karsten Hopp |
ae61a4 |
! goto theend;
|
|
Karsten Hopp |
ae61a4 |
PUSH(frag(s, list1(&s->out)));
|
|
Karsten Hopp |
ae61a4 |
break;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2408,2414 ****
|
|
Karsten Hopp |
ae61a4 |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
nstate++;
|
|
Karsten Hopp |
ae61a4 |
! return NULL; /* Return value when counting size is ignored anyway */
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
--- 2409,2415 ----
|
|
Karsten Hopp |
ae61a4 |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
ae61a4 |
{
|
|
Karsten Hopp |
ae61a4 |
nstate++;
|
|
Karsten Hopp |
ae61a4 |
! goto theend; /* Return value when counting size is ignored anyway */
|
|
Karsten Hopp |
ae61a4 |
}
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
e = POP();
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 2418,2431 ****
|
|
Karsten Hopp |
ae61a4 |
if (istate >= nstate)
|
|
Karsten Hopp |
ae61a4 |
EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA "));
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
- vim_free(stack);
|
|
Karsten Hopp |
ae61a4 |
-
|
|
Karsten Hopp |
ae61a4 |
matchstate = &state_ptr[istate++]; /* the match state */
|
|
Karsten Hopp |
ae61a4 |
matchstate->c = NFA_MATCH;
|
|
Karsten Hopp |
ae61a4 |
matchstate->out = matchstate->out1 = NULL;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, matchstate);
|
|
Karsten Hopp |
ae61a4 |
! return e.start;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
#undef POP1
|
|
Karsten Hopp |
ae61a4 |
#undef PUSH1
|
|
Karsten Hopp |
ae61a4 |
--- 2419,2434 ----
|
|
Karsten Hopp |
ae61a4 |
if (istate >= nstate)
|
|
Karsten Hopp |
ae61a4 |
EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA "));
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
matchstate = &state_ptr[istate++]; /* the match state */
|
|
Karsten Hopp |
ae61a4 |
matchstate->c = NFA_MATCH;
|
|
Karsten Hopp |
ae61a4 |
matchstate->out = matchstate->out1 = NULL;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
patch(e.out, matchstate);
|
|
Karsten Hopp |
ae61a4 |
! ret = e.start;
|
|
Karsten Hopp |
ae61a4 |
!
|
|
Karsten Hopp |
ae61a4 |
! theend:
|
|
Karsten Hopp |
ae61a4 |
! vim_free(stack);
|
|
Karsten Hopp |
ae61a4 |
! return ret;
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
#undef POP1
|
|
Karsten Hopp |
ae61a4 |
#undef PUSH1
|
|
Karsten Hopp |
ae61a4 |
*** ../vim-7.3.989/src/version.c 2013-05-21 15:33:37.000000000 +0200
|
|
Karsten Hopp |
ae61a4 |
--- src/version.c 2013-05-21 16:18:03.000000000 +0200
|
|
Karsten Hopp |
ae61a4 |
***************
|
|
Karsten Hopp |
ae61a4 |
*** 730,731 ****
|
|
Karsten Hopp |
ae61a4 |
--- 730,733 ----
|
|
Karsten Hopp |
ae61a4 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
ae61a4 |
+ /**/
|
|
Karsten Hopp |
ae61a4 |
+ 990,
|
|
Karsten Hopp |
ae61a4 |
/**/
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
--
|
|
Karsten Hopp |
ae61a4 |
This message contains 78% recycled characters.
|
|
Karsten Hopp |
ae61a4 |
|
|
Karsten Hopp |
ae61a4 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
ae61a4 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
ae61a4 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
ae61a4 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|