diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-18 20:53:34 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-18 20:53:34 +0200 |
commit | 92ea26b925a0835badb0af2d5887238a4198cabb (patch) | |
tree | 0ed45513ea242aa5c252f84cc00cf59b155b38e3 /src/evalfunc.c | |
parent | 7751d1d1a3d447d0d48f57f34e0da9f7c6ac433d (diff) |
patch 8.1.2173: searchit() has too many argumentsv8.1.2173
Problem: Searchit() has too many arguments.
Solution: Move optional arguments to a struct. Add the "wrapped" argument.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index c43c8839bd..62a7f06070 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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; |