This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Avoid function call overhead
authorKarl Williamson <khw@cpan.org>
Sun, 10 Aug 2014 00:07:48 +0000 (18:07 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 21 Aug 2014 20:49:46 +0000 (14:49 -0600)
We don't need to call a function to convert from UTF-8 when the value is
invariant in and out of UTF-8.

regcomp.c

index 2a0350c..d3635cc 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -13491,7 +13491,7 @@ parseit:
         }
         else {
             /* Is a backslash; get the code point of the char after it */
-           if (UTF) {
+           if (UTF && ! UTF8_IS_INVARIANT(RExC_parse)) {
                value = utf8n_to_uvchr((U8*)RExC_parse,
                                   RExC_end - RExC_parse,
                                   &numlen, UTF8_ALLOW_DEFAULT);