Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
29188:f96e0bc4494b | 29189:d1e263ecf634 |
---|---|
672 if (extra_arg != NULL) | 672 if (extra_arg != NULL) |
673 { | 673 { |
674 stop_lnum = extra_arg->sa_stop_lnum; | 674 stop_lnum = extra_arg->sa_stop_lnum; |
675 #ifdef FEAT_RELTIME | 675 #ifdef FEAT_RELTIME |
676 if (extra_arg->sa_tm > 0) | 676 if (extra_arg->sa_tm > 0) |
677 { | |
678 init_regexp_timeout(extra_arg->sa_tm); | 677 init_regexp_timeout(extra_arg->sa_tm); |
679 timed_out = &extra_arg->sa_timed_out; | 678 // Also set the pointer when sa_tm is zero, the caller may have set the |
680 } | 679 // timeout. |
680 timed_out = &extra_arg->sa_timed_out; | |
681 #endif | 681 #endif |
682 } | 682 } |
683 | 683 |
684 /* | 684 /* |
685 * find the string | 685 * find the string |
1103 ) | 1103 ) |
1104 break; | 1104 break; |
1105 } | 1105 } |
1106 while (--count > 0 && found); // stop after count matches or no match | 1106 while (--count > 0 && found); // stop after count matches or no match |
1107 | 1107 |
1108 # ifdef FEAT_RELTIME | 1108 #ifdef FEAT_RELTIME |
1109 disable_regexp_timeout(); | 1109 if (extra_arg != NULL && extra_arg->sa_tm > 0) |
1110 # endif | 1110 disable_regexp_timeout(); |
1111 #endif | |
1111 vim_regfree(regmatch.regprog); | 1112 vim_regfree(regmatch.regprog); |
1112 | 1113 |
1113 if (!found) // did not find it | 1114 if (!found) // did not find it |
1114 { | 1115 { |
1115 if (got_int) | 1116 if (got_int) |
4857 matchseq = TRUE; | 4858 matchseq = TRUE; |
4858 } | 4859 } |
4859 | 4860 |
4860 // get the fuzzy matches | 4861 // get the fuzzy matches |
4861 ret = rettv_list_alloc(rettv); | 4862 ret = rettv_list_alloc(rettv); |
4862 if (ret != OK) | 4863 if (ret == FAIL) |
4863 goto done; | 4864 goto done; |
4864 if (retmatchpos) | 4865 if (retmatchpos) |
4865 { | 4866 { |
4866 list_T *l; | 4867 list_T *l; |
4867 | 4868 |