This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Prevent require() from attempting to open directories and block
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 66003af..0ad4c0f 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -302,8 +302,8 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
        /* NOTE: No support for tied ISA */
        I32 items = AvFILLp(av) + 1;
        while (items--) {
-           SV* sv = *svp++;
-           HV* basestash = gv_stashsv(sv, FALSE);
+           SV* const sv = *svp++;
+           HV* const basestash = gv_stashsv(sv, FALSE);
            if (!basestash) {
                if (ckWARN(WARN_MISC))
                    Perl_warner(aTHX_ packWARN(WARN_MISC), "Can't locate package %"SVf" for @%s::ISA",
@@ -320,9 +320,9 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
     /* if at top level, try UNIVERSAL */
 
     if (level == 0 || level == -1) {
-       HV* lastchance;
+       HV* const lastchance = gv_stashpvn("UNIVERSAL", 9, FALSE);
 
-       if ((lastchance = gv_stashpvn("UNIVERSAL", 9, FALSE))) {
+       if (lastchance) {
            if ((gv = gv_fetchmeth(lastchance, name, len,
                                  (level >= 0) ? level + 1 : level - 1)))
            {
@@ -397,20 +397,6 @@ Perl_gv_fetchmeth_autoload(pTHX_ HV *stash, const char *name, STRLEN len, I32 le
 }
 
 /*
-=for apidoc gv_fetchmethod
-
-See L<gv_fetchmethod_autoload>.
-
-=cut
-*/
-
-GV *
-Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name)
-{
-    return gv_fetchmethod_autoload(stash, name, TRUE);
-}
-
-/*
 =for apidoc gv_fetchmethod_autoload
 
 Returns the glob which contains the subroutine to call to invoke the method
@@ -958,7 +944,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
                    hv = GvHVn(gv);
                    hv_magic(hv, Nullgv, PERL_MAGIC_sig);
                    for (i = 1; i < SIG_SIZE; i++) {
-                       SV ** const init = hv_fetch(hv, PL_sig_name[i], strlen(PL_sig_name[i]), 1);
+                       SV * const * const init = hv_fetch(hv, PL_sig_name[i], strlen(PL_sig_name[i]), 1);
                        if (init)
                            sv_setsv(*init, &PL_sv_undef);
                        PL_psig_ptr[i] = 0;
@@ -1183,38 +1169,12 @@ Perl_gv_fullname4(pTHX_ SV *sv, const GV *gv, const char *prefix, bool keepmain)
 }
 
 void
-Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
-{
-    gv_fullname4(sv, gv, prefix, TRUE);
-}
-
-void
 Perl_gv_efullname4(pTHX_ SV *sv, const GV *gv, const char *prefix, bool keepmain)
 {
     const GV * const egv = GvEGV(gv);
     gv_fullname4(sv, egv ? egv : gv, prefix, keepmain);
 }
 
-void
-Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
-{
-    gv_efullname4(sv, gv, prefix, TRUE);
-}
-
-/* compatibility with versions <= 5.003. */
-void
-Perl_gv_fullname(pTHX_ SV *sv, const GV *gv)
-{
-    gv_fullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
-}
-
-/* compatibility with versions <= 5.003. */
-void
-Perl_gv_efullname(pTHX_ SV *sv, const GV *gv)
-{
-    gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
-}
-
 IO *
 Perl_newIO(pTHX)
 {
@@ -1263,14 +1223,14 @@ Perl_gv_check(pTHX_ HV *stash)
                file = GvFILE(gv);
                /* performance hack: if filename is absolute and it's a standard
                 * module, don't bother warning */
-               if (file
-                   && PERL_FILE_IS_ABSOLUTE(file)
 #ifdef MACOS_TRADITIONAL
-                   && (instr(file, ":lib:")
+#   define LIB_COMPONENT ":lib:"
 #else
-                   && (instr(file, "/lib/")
+#   define LIB_COMPONENT "/lib/"
 #endif
-                   || instr(file, ".pm")))
+               if (file
+                   && PERL_FILE_IS_ABSOLUTE(file)
+                   && (instr(file, LIB_COMPONENT) || instr(file, ".pm")))
                {
                    continue;
                }