Avoid calling all the scanning code in gv_fetchpvn_flags when saving
authorNicholas Clark <nick@ccl4.org>
Thu, 9 Feb 2006 12:37:13 +0000 (12:37 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 9 Feb 2006 12:37:13 +0000 (12:37 +0000)
$1 etc, as we can perfom a hash lookup on %:: directly.

p4raw-id: //depot/perl@27134

regcomp.c

index 8bcfb8f8e4b343c9e3c246c48dcace815e5287a9..5d9fb63e531a85d6e5dc4413148121cd9e15a02c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6225,11 +6225,15 @@ Perl_save_re_context(pTHX)
        if (rx) {
            U32 i;
            for (i = 1; i <= rx->nparens; i++) {
+               GV *gv;
                char digits[TYPE_CHARS(long)];
                const STRLEN len = my_sprintf(digits, "%lu", (long)i);
-               GV * const mgv = gv_fetchpvn_flags(digits, len, 0, SVt_PV);
-               if (mgv)
-                   save_scalar(mgv);
+               GV *const *const gvp
+                   = (GV**)hv_fetch(PL_defstash, digits, len, 0);
+
+               if (gvp && SvTYPE(gv = *gvp) == SVt_PVGV && GvSV(gv)) {
+                   save_scalar(gv);
+               }
            }
        }
     }