To: vim_dev@googlegroups.com Subject: Patch 9.0.0282 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0282 Problem: A nested timout stops the previous timeout. Solution: Ignore any nested timeout. Files: src/regexp.c, src/evalfunc.c *** ../vim-9.0.0281/src/regexp.c 2022-07-29 16:22:22.276165855 +0100 --- src/regexp.c 2022-08-26 21:24:04.683232800 +0100 *************** *** 51,67 **** } #ifdef FEAT_RELTIME void init_regexp_timeout(long msec) { ! timeout_flag = start_timeout(msec); } void disable_regexp_timeout(void) { ! stop_timeout(); ! timeout_flag = &dummy_timeout_flag; } #endif --- 51,82 ---- } #ifdef FEAT_RELTIME + static int timeout_nesting = 0; + + /* + * Start a timer that will cause the regexp to abort after "msec". + * This doesn't work well recursively. In case it happens anyway, the first + * set timeout will prevail, nested ones are ignored. + * The caller must make sure there is a matching disable_regexp_timeout() call! + */ void init_regexp_timeout(long msec) { ! if (timeout_nesting == 0) ! timeout_flag = start_timeout(msec); ! ++timeout_nesting; } void disable_regexp_timeout(void) { ! if (timeout_nesting == 0) ! iemsg("disable_regexp_timeout() called without active timer"); ! else if (--timeout_nesting == 0) ! { ! stop_timeout(); ! timeout_flag = &dummy_timeout_flag; ! } } #endif *** ../vim-9.0.0281/src/evalfunc.c 2022-08-26 17:52:47.890406156 +0100 --- src/evalfunc.c 2022-08-26 21:28:55.210917990 +0100 *************** *** 9176,9182 **** theend: #ifdef FEAT_RELTIME ! disable_regexp_timeout(); #endif vim_free(pat2); vim_free(pat3); --- 9176,9183 ---- theend: #ifdef FEAT_RELTIME ! if (time_limit > 0) ! disable_regexp_timeout(); #endif vim_free(pat2); vim_free(pat3); *** ../vim-9.0.0281/src/version.c 2022-08-26 19:58:45.947700271 +0100 --- src/version.c 2022-08-26 21:19:01.503603948 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 282, /**/ -- Violators can be fined, arrested or jailed for making ugly faces at a dog. [real standing law in Oklahoma, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///