Mercurial > vim
diff src/search.c @ 29189:d1e263ecf634 v8.2.5114
patch 8.2.5114: time limit on searchpair() does not work properly
Commit: https://github.com/vim/vim/commit/5ea38d1e7fd597ffde13b292d43e12747f20e97f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 16 21:20:48 2022 +0100
patch 8.2.5114: time limit on searchpair() does not work properly
Problem: Time limit on searchpair() does not work properly.
Solution: Set the time limit once instead of for each regexp. (closes https://github.com/vim/vim/issues/10562)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Jun 2022 22:30:03 +0200 |
parents | b90bca860b5a |
children | f92f658585e6 |
line wrap: on
line diff
--- a/src/search.c +++ b/src/search.c @@ -674,10 +674,10 @@ searchit( stop_lnum = extra_arg->sa_stop_lnum; #ifdef FEAT_RELTIME if (extra_arg->sa_tm > 0) - { init_regexp_timeout(extra_arg->sa_tm); - timed_out = &extra_arg->sa_timed_out; - } + // Also set the pointer when sa_tm is zero, the caller may have set the + // timeout. + timed_out = &extra_arg->sa_timed_out; #endif } @@ -1105,9 +1105,10 @@ searchit( } while (--count > 0 && found); // stop after count matches or no match -# ifdef FEAT_RELTIME - disable_regexp_timeout(); -# endif +#ifdef FEAT_RELTIME + if (extra_arg != NULL && extra_arg->sa_tm > 0) + disable_regexp_timeout(); +#endif vim_regfree(regmatch.regprog); if (!found) // did not find it @@ -4859,7 +4860,7 @@ do_fuzzymatch(typval_T *argvars, typval_ // get the fuzzy matches ret = rettv_list_alloc(rettv); - if (ret != OK) + if (ret == FAIL) goto done; if (retmatchpos) {