This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_in_load_module only has values 0 and 1, so can be a bool instead of int.
authorNicholas Clark <nick@ccl4.org>
Fri, 21 May 2010 19:32:28 +0000 (20:32 +0100)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 May 2010 19:32:28 +0000 (20:32 +0100)
intrpvar.h
perlio.c

index 4af88f6..bfa613c 100644 (file)
@@ -257,7 +257,7 @@ PERLVAR(Iexit_flags,        U8)             /* was exit() unexpected, etc. */
 PERLVAR(Isrand_called, bool)
 /* Part of internal state, but makes the 16th 1 byte variable in a row.  */
 PERLVAR(Itainting,     bool)           /* doing taint checks */
-/* Space for a U8 */
+PERLVARI(Iin_load_module, bool, FALSE) /* to prevent recursions in PerlIO_find_layer */
 PERLVAR(Iinplace,      char *)
 PERLVAR(Ie_script,     SV *)
 
@@ -632,7 +632,7 @@ PERLVARI(Iunitcheckav_save, AV*, NULL)      /* save UNITCHECK{}s when compiling */
 
 PERLVARI(Iclocktick, long, 0)  /* this many times() ticks in a second */
 
-PERLVARI(Iin_load_module, int, 0)      /* to prevent recursions in PerlIO_find_layer */
+/* Space for an int */
 
 PERLVAR(Iunicode, U32) /* Unicode features: $ENV{PERL_UNICODE} or -C */
 
index d015b58..57a61d9 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -807,17 +807,16 @@ PerlIO_find_layer(pTHX_ const char *name, STRLEN len, int load)
            SV * const layer = newSVpvn(name, len);
            CV * const cv    = get_cvs("PerlIO::Layer::NoWarnings", 0);
            ENTER;
-           SAVEINT(PL_in_load_module);
+           SAVEBOOL(PL_in_load_module);
            if (cv) {
                SAVEGENERICSV(PL_warnhook);
                PL_warnhook = MUTABLE_SV((SvREFCNT_inc_simple_NN(cv)));
            }
-           PL_in_load_module++;
+           PL_in_load_module = TRUE;
            /*
             * The two SVs are magically freed by load_module
             */
            Perl_load_module(aTHX_ 0, pkgsv, NULL, layer, NULL);
-           PL_in_load_module--;
            LEAVE;
            return PerlIO_find_layer(aTHX_ name, len, 0);
        }