This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_multiconcat() Use faster variant counting
authorKarl Williamson <khw@cpan.org>
Thu, 23 Nov 2017 06:10:01 +0000 (23:10 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 15 Mar 2019 16:30:28 +0000 (10:30 -0600)
op.c

diff --git a/op.c b/op.c
index b4ba9c8..1f7ae3e 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3102,13 +3102,8 @@ S_maybe_multiconcat(pTHX_ OP *o)
         
         /* see if any strings would grow if converted to utf8 */
         if (!utf8) {
         
         /* see if any strings would grow if converted to utf8 */
         if (!utf8) {
-            char *p    = (char*)argp->p;
-            STRLEN len = argp->len;
-            while (len--) {
-                U8 c = *p++;
-                if (!UTF8_IS_INVARIANT(c))
-                    variant++;
-            }
+            variant += variant_under_utf8_count((U8 *) argp->p,
+                                                (U8 *) argp->p + argp->len);
         }
     }
 
         }
     }