Mercurial > vim
diff src/evalfunc.c @ 18358:34d5cd432cac v8.1.2173
patch 8.1.2173: searchit() has too many arguments
Commit: https://github.com/vim/vim/commit/92ea26b925a0835badb0af2d5887238a4198cabb
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 18 20:53:34 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 18 Oct 2019 21:00:04 +0200 |
parents | 9f51d0cef8da |
children | e9675870c480 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5694,12 +5694,13 @@ search_cmn(typval_T *argvars, pos_T *mat int dir; int retval = 0; /* default: FAIL */ long lnum_stop = 0; +#ifdef FEAT_RELTIME proftime_T tm; -#ifdef FEAT_RELTIME 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 *mat } 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;