op.c:ck_glob: Don’t do gv_fetchpv("CORE::GLOBAL::glob")
authorFather Chrysostomos <sprout@cpan.org>
Sun, 29 Apr 2012 18:11:15 +0000 (11:11 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 22 May 2012 04:37:36 +0000 (21:37 -0700)
We have PL_globalstash precisely to avoid the nested stash lookup in
cases like these.

op.c

diff --git a/op.c b/op.c
index b86f094..1d199dc 100644 (file)
--- a/op.c
+++ b/op.c
@@ -8142,7 +8142,9 @@ Perl_ck_glob(pTHX_ OP *o)
     else if (!((gv = gv_fetchpvs("glob", GV_NOTQUAL, SVt_PVCV))
          && GvCVu(gv) && GvIMPORTED_CV(gv)))
     {
-       gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV);
+       GV * const * const gvp =
+           (GV **)hv_fetchs(PL_globalstash, "glob", FALSE);
+       gv = gvp ? *gvp : NULL;
     }
 
     if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) {