1
0
forked from aniani/vim

patch 8.1.2173: searchit() has too many arguments

Problem:    Searchit() has too many arguments.
Solution:   Move optional arguments to a struct.  Add the "wrapped" argument.
This commit is contained in:
Bram Moolenaar
2019-10-18 20:53:34 +02:00
parent 7751d1d1a3
commit 92ea26b925
13 changed files with 97 additions and 47 deletions

View File

@@ -5694,12 +5694,13 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
int dir;
int retval = 0; /* default: FAIL */
long lnum_stop = 0;
proftime_T tm;
#ifdef FEAT_RELTIME
proftime_T tm;
long time_limit = 0;
#endif
int options = SEARCH_KEEP;
int subpatnum;
searchit_arg_T sia;
pat = tv_get_string(&argvars[0]);
dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
@@ -5748,8 +5749,13 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
}
pos = save_cursor = curwin->w_cursor;
vim_memset(&sia, 0, sizeof(sia));
sia.sa_stop_lnum = (linenr_T)lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
#endif
subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, (linenr_T)lnum_stop, &tm, NULL);
options, RE_SEARCH, &sia);
if (subpatnum != FAIL)
{
if (flags & SP_SUBPAT)
@@ -6147,7 +6153,9 @@ do_searchpair(
int use_skip = FALSE;
int err;
int options = SEARCH_KEEP;
#ifdef FEAT_RELTIME
proftime_T tm;
#endif
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
@@ -6188,8 +6196,15 @@ do_searchpair(
pat = pat3;
for (;;)
{
searchit_arg_T sia;
vim_memset(&sia, 0, sizeof(sia));
sia.sa_stop_lnum = lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = &tm;
#endif
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, lnum_stop, &tm, NULL);
options, RE_SEARCH, &sia);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
/* didn't find it or found the first match again: FAIL */
break;