diff options
author | Klemen Košir <klemen913@gmail.com> | 2014-04-27 13:40:53 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-29 10:32:04 -0300 |
commit | 463d0940e30ed16c6d2f6b40923aed2b4999e80b (patch) | |
tree | 44e76457df57cefa52d843c2dd0217b73380f144 /src/regexp_nfa.c | |
parent | 852f0aaae8c82ed879df8bbe9cb1914002dad954 (diff) | |
download | rneovim-463d0940e30ed16c6d2f6b40923aed2b4999e80b.tar.gz rneovim-463d0940e30ed16c6d2f6b40923aed2b4999e80b.tar.bz2 rneovim-463d0940e30ed16c6d2f6b40923aed2b4999e80b.zip |
vim-patch:7.4.262
Problem: Duplicate code in regexec().
Solution: Add line_lbr flag to regexec_nl().
https://code.google.com/p/vim/source/detail?r=0ea551fa607dc443b97c2fba97dc0c9cb0bcf303
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r-- | src/regexp_nfa.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index f22848cce5..52dc228bb2 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -311,7 +311,7 @@ static long nfa_regtry(nfa_regprog_T *prog, colnr_T col); static long nfa_regexec_both(char_u *line, colnr_T col); static regprog_T *nfa_regcomp(char_u *expr, int re_flags); static void nfa_regfree(regprog_T *prog); -static int nfa_regexec(regmatch_T *rmp, char_u *line, colnr_T col); +static int nfa_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col, bool line_lbr); static long nfa_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm); @@ -6356,47 +6356,22 @@ static void nfa_regfree(regprog_T *prog) * Match a regexp against a string. * "rmp->regprog" is a compiled regexp as returned by nfa_regcomp(). * Uses curbuf for line count and 'iskeyword'. + * If "line_lbr" is true, consider a "\n" in "line" to be a line break. * * Return TRUE if there is a match, FALSE if not. */ static int -nfa_regexec ( - regmatch_T *rmp, - char_u *line, /* string to match against */ - colnr_T col /* column to start looking for match */ -) -{ - reg_match = rmp; - reg_mmatch = NULL; - reg_maxline = 0; - reg_line_lbr = FALSE; - reg_buf = curbuf; - reg_win = NULL; - ireg_ic = rmp->rm_ic; - ireg_icombine = FALSE; - ireg_maxcol = 0; - return nfa_regexec_both(line, col) != 0; -} - -#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ - || defined(FIND_REPLACE_DIALOG) || defined(PROTO) - -static int nfa_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col); - -/* - * Like nfa_regexec(), but consider a "\n" in "line" to be a line break. - */ -static int nfa_regexec_nl ( regmatch_T *rmp, char_u *line, /* string to match against */ - colnr_T col /* column to start looking for match */ + colnr_T col, /* column to start looking for match */ + bool line_lbr ) { reg_match = rmp; reg_mmatch = NULL; reg_maxline = 0; - reg_line_lbr = TRUE; + reg_line_lbr = line_lbr; reg_buf = curbuf; reg_win = NULL; ireg_ic = rmp->rm_ic; @@ -6404,8 +6379,6 @@ nfa_regexec_nl ( ireg_maxcol = 0; return nfa_regexec_both(line, col) != 0; } -#endif - /* * Match a regexp against multiple lines. |