This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
56dd984
)
regexec.c: Replace loop by memchr()
author
Karl Williamson
<khw@cpan.org>
Wed, 27 Dec 2017 01:25:26 +0000
(18:25 -0700)
committer
Karl Williamson
<khw@cpan.org>
Tue, 30 Jan 2018 18:38:12 +0000
(11:38 -0700)
This can be called on a potentially long string.
regexec.c
patch
|
blob
|
blame
|
history
diff --git
a/regexec.c
b/regexec.c
index
5a1c5ef
..
ac8b15e
100644
(file)
--- a/
regexec.c
+++ b/
regexec.c
@@
-9003,8
+9003,10
@@
S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
hardcount++;
}
} else {
- while (scan < loceol && *scan != '\n')
- scan++;
+ scan = (char *) memchr(scan, '\n', loceol - scan);
+ if (! scan) {
+ scan = loceol;
+ }
}
break;
case SANY: