diff options
author | Karl Williamson <khw@cpan.org> | 2017-12-26 18:13:36 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-12-30 10:41:59 -0700 |
commit | f844b04230c9dbb5970369720a687afeea605cb3 (patch) | |
tree | cd08e7751c272eaa3aaf9812286bc55cec2a3a2e /regexec.c | |
parent | dce3f5c3fd788f1c2e451e3760f05a347c949eff (diff) | |
download | perl-f844b04230c9dbb5970369720a687afeea605cb3.tar.gz |
regexec.c: Replace loop by memchr()
This loop can be potentially very long as it is used to find the next
place there is a potential match in something like /(foo)+abc/. (It's
trying to find the 'a' in that example.
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -8653,9 +8653,12 @@ NULL } else { /* Not utf8_target */ if (ST.c1 == ST.c2) { - while (locinput <= ST.maxpos && - UCHARAT(locinput) != ST.c1) - locinput++; + locinput = (char *) memchr(locinput, + ST.c1, + ST.maxpos + 1 - locinput); + if (! locinput) { + locinput = ST.maxpos + 1; + } } else { U8 c1_c2_bits_differing = ST.c1 ^ ST.c2; |