Skip to content

Commit

Permalink
toke.c: lex_stuff_pvn() Use faster UTF-8 variant count
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Jan 25, 2018
1 parent 1a9ff13 commit 75edfd5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions toke.c
Expand Up @@ -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);
Expand Down

0 comments on commit 75edfd5

Please sign in to comment.