This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_multiconcat() Use faster variant counting
[perl5.git] / 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) {
-            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);
         }
     }