From 75edfd5e6c25907145addb2d04f69a3f43189a20 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 22 Nov 2017 23:12:37 -0700 Subject: [PATCH] toke.c: lex_stuff_pvn() Use faster UTF-8 variant count --- toke.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/toke.c b/toke.c index 5959bc3e9e0f..27b4feb714d8 100644 --- a/toke.c +++ b/toke.c @@ -1019,13 +1019,9 @@ Perl_lex_stuff_pvn(pTHX_ const char *pv, STRLEN len, U32 flags) if (flags & LEX_STUFF_UTF8) { goto plain_copy; } else { - STRLEN highhalf = 0; /* Count of variants */ - const char *p, *e = pv+len; - for (p = pv; p != e; p++) { - if (! UTF8_IS_INVARIANT(*p)) { - highhalf++; - } - } + STRLEN highhalf = variant_under_utf8_count((U8 *) pv, + (U8 *) pv + len); + const char *p, *e = pv+len;; if (!highhalf) goto plain_copy; lex_grow_linestr(SvCUR(PL_parser->linestr)+1+len+highhalf);