|
Karsten Hopp |
5e9ac1 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
5e9ac1 |
Subject: Patch 7.4.613
|
|
Karsten Hopp |
5e9ac1 |
Fcc: outbox
|
|
Karsten Hopp |
5e9ac1 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
5e9ac1 |
Mime-Version: 1.0
|
|
Karsten Hopp |
5e9ac1 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
5e9ac1 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
5e9ac1 |
------------
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
Patch 7.4.613
|
|
Karsten Hopp |
5e9ac1 |
Problem: The NFA engine does not implement the 'redrawtime' time limit.
|
|
Karsten Hopp |
5e9ac1 |
Solution: Implement the time limit.
|
|
Karsten Hopp |
5e9ac1 |
Files: src/regexp_nfa.c
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
*** ../vim-7.4.612/src/regexp_nfa.c 2015-01-27 14:54:07.944583588 +0100
|
|
Karsten Hopp |
5e9ac1 |
--- src/regexp_nfa.c 2015-02-03 16:25:58.681726505 +0100
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 311,318 ****
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_save_listids __ARGS((nfa_regprog_T *prog, int *list));
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_restore_listids __ARGS((nfa_regprog_T *prog, int *list));
|
|
Karsten Hopp |
5e9ac1 |
static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
|
|
Karsten Hopp |
5e9ac1 |
! static long nfa_regtry __ARGS((nfa_regprog_T *prog, colnr_T col));
|
|
Karsten Hopp |
5e9ac1 |
! static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
|
|
Karsten Hopp |
5e9ac1 |
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_regfree __ARGS((regprog_T *prog));
|
|
Karsten Hopp |
5e9ac1 |
static int nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr));
|
|
Karsten Hopp |
5e9ac1 |
--- 311,318 ----
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_save_listids __ARGS((nfa_regprog_T *prog, int *list));
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_restore_listids __ARGS((nfa_regprog_T *prog, int *list));
|
|
Karsten Hopp |
5e9ac1 |
static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
|
|
Karsten Hopp |
5e9ac1 |
! static long nfa_regtry __ARGS((nfa_regprog_T *prog, colnr_T col, proftime_T *tm));
|
|
Karsten Hopp |
5e9ac1 |
! static long nfa_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
|
|
Karsten Hopp |
5e9ac1 |
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
|
|
Karsten Hopp |
5e9ac1 |
static void nfa_regfree __ARGS((regprog_T *prog));
|
|
Karsten Hopp |
5e9ac1 |
static int nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr));
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 3850,3855 ****
|
|
Karsten Hopp |
5e9ac1 |
--- 3850,3859 ----
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
/* Used during execution: whether a match has been found. */
|
|
Karsten Hopp |
5e9ac1 |
static int nfa_match;
|
|
Karsten Hopp |
5e9ac1 |
+ #ifdef FEAT_RELTIME
|
|
Karsten Hopp |
5e9ac1 |
+ static proftime_T *nfa_time_limit;
|
|
Karsten Hopp |
5e9ac1 |
+ static int nfa_time_count;
|
|
Karsten Hopp |
5e9ac1 |
+ #endif
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
static void copy_pim __ARGS((nfa_pim_T *to, nfa_pim_T *from));
|
|
Karsten Hopp |
5e9ac1 |
static void clear_sub __ARGS((regsub_T *sub));
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 5449,5454 ****
|
|
Karsten Hopp |
5e9ac1 |
--- 5453,5462 ----
|
|
Karsten Hopp |
5e9ac1 |
fast_breakcheck();
|
|
Karsten Hopp |
5e9ac1 |
if (got_int)
|
|
Karsten Hopp |
5e9ac1 |
return FALSE;
|
|
Karsten Hopp |
5e9ac1 |
+ #ifdef FEAT_RELTIME
|
|
Karsten Hopp |
5e9ac1 |
+ if (nfa_time_limit != NULL && profile_passed_limit(nfa_time_limit))
|
|
Karsten Hopp |
5e9ac1 |
+ return FALSE;
|
|
Karsten Hopp |
5e9ac1 |
+ #endif
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
nfa_match = FALSE;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 6789,6797 ****
|
|
Karsten Hopp |
5e9ac1 |
break;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
/* Allow interrupting with CTRL-C. */
|
|
Karsten Hopp |
5e9ac1 |
! fast_breakcheck();
|
|
Karsten Hopp |
5e9ac1 |
if (got_int)
|
|
Karsten Hopp |
5e9ac1 |
break;
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
5e9ac1 |
--- 6797,6814 ----
|
|
Karsten Hopp |
5e9ac1 |
break;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
/* Allow interrupting with CTRL-C. */
|
|
Karsten Hopp |
5e9ac1 |
! line_breakcheck();
|
|
Karsten Hopp |
5e9ac1 |
if (got_int)
|
|
Karsten Hopp |
5e9ac1 |
break;
|
|
Karsten Hopp |
5e9ac1 |
+ #ifdef FEAT_RELTIME
|
|
Karsten Hopp |
5e9ac1 |
+ /* Check for timeout once in a twenty times to avoid overhead. */
|
|
Karsten Hopp |
5e9ac1 |
+ if (nfa_time_limit != NULL && ++nfa_time_count == 20)
|
|
Karsten Hopp |
5e9ac1 |
+ {
|
|
Karsten Hopp |
5e9ac1 |
+ nfa_time_count = 0;
|
|
Karsten Hopp |
5e9ac1 |
+ if (profile_passed_limit(nfa_time_limit))
|
|
Karsten Hopp |
5e9ac1 |
+ break;
|
|
Karsten Hopp |
5e9ac1 |
+ }
|
|
Karsten Hopp |
5e9ac1 |
+ #endif
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 6818,6826 ****
|
|
Karsten Hopp |
5e9ac1 |
* Returns <= 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
5e9ac1 |
*/
|
|
Karsten Hopp |
5e9ac1 |
static long
|
|
Karsten Hopp |
5e9ac1 |
! nfa_regtry(prog, col)
|
|
Karsten Hopp |
5e9ac1 |
nfa_regprog_T *prog;
|
|
Karsten Hopp |
5e9ac1 |
colnr_T col;
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
int i;
|
|
Karsten Hopp |
5e9ac1 |
regsubs_T subs, m;
|
|
Karsten Hopp |
5e9ac1 |
--- 6835,6844 ----
|
|
Karsten Hopp |
5e9ac1 |
* Returns <= 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
5e9ac1 |
*/
|
|
Karsten Hopp |
5e9ac1 |
static long
|
|
Karsten Hopp |
5e9ac1 |
! nfa_regtry(prog, col, tm)
|
|
Karsten Hopp |
5e9ac1 |
nfa_regprog_T *prog;
|
|
Karsten Hopp |
5e9ac1 |
colnr_T col;
|
|
Karsten Hopp |
5e9ac1 |
+ proftime_T *tm; /* timeout limit or NULL */
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
int i;
|
|
Karsten Hopp |
5e9ac1 |
regsubs_T subs, m;
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 6831,6836 ****
|
|
Karsten Hopp |
5e9ac1 |
--- 6849,6858 ----
|
|
Karsten Hopp |
5e9ac1 |
#endif
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
reginput = regline + col;
|
|
Karsten Hopp |
5e9ac1 |
+ #ifdef FEAT_RELTIME
|
|
Karsten Hopp |
5e9ac1 |
+ nfa_time_limit = tm;
|
|
Karsten Hopp |
5e9ac1 |
+ nfa_time_count = 0;
|
|
Karsten Hopp |
5e9ac1 |
+ #endif
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
5e9ac1 |
f = fopen(NFA_REGEXP_RUN_LOG, "a");
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 6951,6959 ****
|
|
Karsten Hopp |
5e9ac1 |
* Returns <= 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
5e9ac1 |
*/
|
|
Karsten Hopp |
5e9ac1 |
static long
|
|
Karsten Hopp |
5e9ac1 |
! nfa_regexec_both(line, startcol)
|
|
Karsten Hopp |
5e9ac1 |
char_u *line;
|
|
Karsten Hopp |
5e9ac1 |
colnr_T startcol; /* column to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
nfa_regprog_T *prog;
|
|
Karsten Hopp |
5e9ac1 |
long retval = 0L;
|
|
Karsten Hopp |
5e9ac1 |
--- 6973,6982 ----
|
|
Karsten Hopp |
5e9ac1 |
* Returns <= 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
5e9ac1 |
*/
|
|
Karsten Hopp |
5e9ac1 |
static long
|
|
Karsten Hopp |
5e9ac1 |
! nfa_regexec_both(line, startcol, tm)
|
|
Karsten Hopp |
5e9ac1 |
char_u *line;
|
|
Karsten Hopp |
5e9ac1 |
colnr_T startcol; /* column to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
+ proftime_T *tm; /* timeout limit or NULL */
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
nfa_regprog_T *prog;
|
|
Karsten Hopp |
5e9ac1 |
long retval = 0L;
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 7047,7053 ****
|
|
Karsten Hopp |
5e9ac1 |
prog->state[i].lastlist[1] = 0;
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
! retval = nfa_regtry(prog, col);
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
nfa_regengine.expr = NULL;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
--- 7070,7076 ----
|
|
Karsten Hopp |
5e9ac1 |
prog->state[i].lastlist[1] = 0;
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
! retval = nfa_regtry(prog, col, tm);
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
nfa_regengine.expr = NULL;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 7209,7215 ****
|
|
Karsten Hopp |
5e9ac1 |
ireg_icombine = FALSE;
|
|
Karsten Hopp |
5e9ac1 |
#endif
|
|
Karsten Hopp |
5e9ac1 |
ireg_maxcol = 0;
|
|
Karsten Hopp |
5e9ac1 |
! return nfa_regexec_both(line, col);
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
--- 7232,7238 ----
|
|
Karsten Hopp |
5e9ac1 |
ireg_icombine = FALSE;
|
|
Karsten Hopp |
5e9ac1 |
#endif
|
|
Karsten Hopp |
5e9ac1 |
ireg_maxcol = 0;
|
|
Karsten Hopp |
5e9ac1 |
! return nfa_regexec_both(line, col, NULL);
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 7245,7251 ****
|
|
Karsten Hopp |
5e9ac1 |
buf_T *buf; /* buffer in which to search */
|
|
Karsten Hopp |
5e9ac1 |
linenr_T lnum; /* nr of line to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
colnr_T col; /* column to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
! proftime_T *tm UNUSED; /* timeout limit or NULL */
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
reg_match = NULL;
|
|
Karsten Hopp |
5e9ac1 |
reg_mmatch = rmp;
|
|
Karsten Hopp |
5e9ac1 |
--- 7268,7274 ----
|
|
Karsten Hopp |
5e9ac1 |
buf_T *buf; /* buffer in which to search */
|
|
Karsten Hopp |
5e9ac1 |
linenr_T lnum; /* nr of line to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
colnr_T col; /* column to start looking for match */
|
|
Karsten Hopp |
5e9ac1 |
! proftime_T *tm; /* timeout limit or NULL */
|
|
Karsten Hopp |
5e9ac1 |
{
|
|
Karsten Hopp |
5e9ac1 |
reg_match = NULL;
|
|
Karsten Hopp |
5e9ac1 |
reg_mmatch = rmp;
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 7260,7266 ****
|
|
Karsten Hopp |
5e9ac1 |
#endif
|
|
Karsten Hopp |
5e9ac1 |
ireg_maxcol = rmp->rmm_maxcol;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
! return nfa_regexec_both(NULL, col);
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
#ifdef DEBUG
|
|
Karsten Hopp |
5e9ac1 |
--- 7283,7289 ----
|
|
Karsten Hopp |
5e9ac1 |
#endif
|
|
Karsten Hopp |
5e9ac1 |
ireg_maxcol = rmp->rmm_maxcol;
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
! return nfa_regexec_both(NULL, col, tm);
|
|
Karsten Hopp |
5e9ac1 |
}
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
#ifdef DEBUG
|
|
Karsten Hopp |
5e9ac1 |
*** ../vim-7.4.612/src/version.c 2015-02-03 16:07:44.193584399 +0100
|
|
Karsten Hopp |
5e9ac1 |
--- src/version.c 2015-02-03 16:48:54.770821421 +0100
|
|
Karsten Hopp |
5e9ac1 |
***************
|
|
Karsten Hopp |
5e9ac1 |
*** 743,744 ****
|
|
Karsten Hopp |
5e9ac1 |
--- 743,746 ----
|
|
Karsten Hopp |
5e9ac1 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
5e9ac1 |
+ /**/
|
|
Karsten Hopp |
5e9ac1 |
+ 613,
|
|
Karsten Hopp |
5e9ac1 |
/**/
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
--
|
|
Karsten Hopp |
5e9ac1 |
In Joseph Heller's novel "Catch-22", the main character tries to get out of a
|
|
Karsten Hopp |
5e9ac1 |
war by proving he is crazy. But the mere fact he wants to get out of the war
|
|
Karsten Hopp |
5e9ac1 |
only shows he isn't crazy -- creating the original "Catch-22".
|
|
Karsten Hopp |
5e9ac1 |
|
|
Karsten Hopp |
5e9ac1 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
5e9ac1 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
5e9ac1 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
5e9ac1 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|