diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-19 10:57:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-19 10:57:06 +0800 |
commit | f2b30b4d62b97da6ae1b4dd7c4e5730fc5bc95f7 (patch) | |
tree | f2a2cc60cabd9d718eed72faeeaa5871cd189ad2 /src/nvim/regexp.c | |
parent | db407010facc55c19b5ebdf881225ac39cb29d01 (diff) | |
download | rneovim-f2b30b4d62b97da6ae1b4dd7c4e5730fc5bc95f7.tar.gz rneovim-f2b30b4d62b97da6ae1b4dd7c4e5730fc5bc95f7.tar.bz2 rneovim-f2b30b4d62b97da6ae1b4dd7c4e5730fc5bc95f7.zip |
vim-patch:8.2.0260: several lines of code are duplicated (#21108)
Problem: Several lines of code are duplicated.
Solution: Move duplicated code to a function. (Yegappan Lakshmanan,
closes vim/vim#5330)
https://github.com/vim/vim/commit/f4140488c72cad4dbf5449dba099cfa7de7bbb22
Using sizeof seems better than ARRAY_SIZE for vim_snprintf().
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 1aa78a3cba..95557a3469 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2241,6 +2241,25 @@ list_T *reg_submatch_list(int no) return list; } +/// Initialize the values used for matching against multiple lines +/// +/// @param win window in which to search or NULL +/// @param buf buffer in which to search +/// @param lnum nr of line to start looking for match +static void init_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum) +{ + rex.reg_match = NULL; + rex.reg_mmatch = rmp; + rex.reg_buf = buf; + rex.reg_win = win; + rex.reg_firstlnum = lnum; + rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum; + rex.reg_line_lbr = false; + rex.reg_ic = rmp->rmm_ic; + rex.reg_icombine = false; + rex.reg_maxcol = rmp->rmm_maxcol; +} + // XXX Do not allow headers generator to catch definitions from regexp_nfa.c #ifndef DO_NOT_DEFINE_EMPTY_ATTRIBUTES # include "nvim/regexp_bt.c" |