Re: C<undef %::> considered harmful
Benjamin Sugars [Fri, 20 Apr 2001 10:30:20 +0000 (06:30 -0400)]
Message-ID: <Pine.LNX.4.21.0104201022040.1722-100000@marmot.rim.canoe.ca>

except the part that increases the refcount of PL_stderrgv, already
fixed separately.

p4raw-id: //depot/perl@26043

perl.c

diff --git a/perl.c b/perl.c
index 4a15b0c..25755cc 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3440,11 +3440,14 @@ S_init_main_stash(pTHX)
     SvREADONLY_on(gv);
     hv_name_set(PL_defstash, "main", 4, 0);
     PL_incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV)));
+    SvREFCNT_inc(PL_incgv); /* Don't allow it to be freed */
     GvMULTI_on(PL_incgv);
     PL_hintgv = gv_fetchpv("\010",TRUE, SVt_PV); /* ^H */
     GvMULTI_on(PL_hintgv);
     PL_defgv = gv_fetchpv("_",TRUE, SVt_PVAV);
+    SvREFCNT_inc(PL_defgv);
     PL_errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV));
+    SvREFCNT_inc(PL_errgv);
     GvMULTI_on(PL_errgv);
     PL_replgv = gv_fetchpv("\022", TRUE, SVt_PV); /* ^R */
     GvMULTI_on(PL_replgv);