summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-06-27 20:53:44 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-27 20:53:44 +0000
commitcc07378bd850d5f9faaa12b44277d091729e30f0 (patch)
tree7a1af794cf57f3e7385b9692605bc8f94430a1d9
parentb11f357e172c58160ed5ae754def443bbae9bacb (diff)
downloadperl-cc07378bd850d5f9faaa12b44277d091729e30f0.tar.gz
Inlining to avoid costly UTF-8 calls.
p4raw-id: //depot/perl@17372
-rw-r--r--regexec.c7
-rw-r--r--sv.c8
2 files changed, 9 insertions, 6 deletions
diff --git a/regexec.c b/regexec.c
index f196cb7cfd..389fa1d669 100644
--- a/regexec.c
+++ b/regexec.c
@@ -4328,12 +4328,13 @@ S_reginclass(pTHX_ register regnode *n, register U8* p, STRLEN* lenp, register b
{
char flags = ANYOF_FLAGS(n);
bool match = FALSE;
- UV c;
+ UV c = *p;
STRLEN len = 0;
STRLEN plen;
- c = do_utf8 ? utf8n_to_uvchr(p, UTF8_MAXLEN, &len,
- ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY) : *p;
+ if (do_utf8 && !UTF8_IS_INVARIANT(c))
+ c = utf8n_to_uvchr(p, UTF8_MAXLEN, &len,
+ ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
plen = lenp ? *lenp : UNISKIP(NATIVE_TO_UNI(c));
if (do_utf8 || (flags & ANYOF_UNICODE)) {
diff --git a/sv.c b/sv.c
index 1c1932ac42..fa629aec8f 100644
--- a/sv.c
+++ b/sv.c
@@ -5313,9 +5313,11 @@ Perl_sv_pos_b2u(pTHX_ register SV *sv, I32* offsetp)
send = s + *offsetp;
len = 0;
while (s < send) {
- STRLEN n;
- /* Call utf8n_to_uvchr() to validate the sequence */
- utf8n_to_uvchr(s, UTF8SKIP(s), &n, 0);
+ STRLEN n = 1;
+ /* Call utf8n_to_uvchr() to validate the sequence
+ * (unless a simple non-UTF character) */
+ if (!UTF8_IS_INVARIANT(*s))
+ utf8n_to_uvchr(s, UTF8SKIP(s), &n, 0);
if (n > 0) {
s += n;
len++;