diff options
author | Karl Williamson <khw@cpan.org> | 2018-11-06 18:10:36 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-11-16 10:48:19 -0700 |
commit | d1be211cd36639caeb3c7482759d9bed530ecaad (patch) | |
tree | 441cebda3258e8c8abd7d07670c4f4defa0075ce /regcomp.c | |
parent | 523a2924740c68b1653d1c68aea5c8d7fb9161e4 (diff) | |
download | perl-d1be211cd36639caeb3c7482759d9bed530ecaad.tar.gz |
regcomp.c: Don't restart parse for /d to /u if reparsing anyway
Prior to this commit, if the rules changed from /d to /u, the parse was
immediately restarted. This commit changes that so that it doesn't do
this if it is known that the parse will be redone anyway, but a full
parse needs to done first in order to count the parentheses.
Doing this can avoid the need for an almost full extra reparse.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -349,8 +349,12 @@ struct RExC_state_t { if (DEPENDS_SEMANTICS) { \ set_regex_charset(&RExC_flags, REGEX_UNICODE_CHARSET); \ RExC_uni_semantics = 1; \ + if (LIKELY(RExC_total_parens >= 0)) { \ + /* No need to restart the parse immediately if we're \ + * going to reparse anyway to count parens */ \ *flagp |= RESTART_PARSE; \ return restart_retval; \ + } \ } \ } STMT_END |