Fixes to -DPERL_DONT_CREATE_GVSV to make more tests pass
Nicholas Clark [Wed, 29 Jun 2005 19:25:24 +0000 (19:25 +0000)]
p4raw-id: //depot/perl@25010

doio.c
gv.c
perl.h
sv.c

diff --git a/doio.c b/doio.c
index a2300fc..b62a473 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -773,7 +773,7 @@ Perl_nextargv(pTHX_ register GV *gv)
        STRLEN oldlen;
        sv = av_shift(GvAV(gv));
        SAVEFREESV(sv);
-       sv_setsv(GvSV(gv),sv);
+       sv_setsv(GvSVn(gv),sv);
        SvSETMAGIC(GvSV(gv));
        PL_oldname = SvPVx(GvSV(gv), oldlen);
        if (do_open(gv,PL_oldname,oldlen,PL_inplace!=0,O_RDONLY,0,Nullfp)) {
diff --git a/gv.c b/gv.c
index e6993ad..39f4b6a 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -582,7 +582,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
 #endif
     }
     LEAVE;
-    varsv = GvSV(vargv);
+    varsv = GvSVn(vargv);
     sv_setpvn(varsv, packname, packname_len);
     sv_catpvn(varsv, "::", 2);
     sv_catpvn(varsv, name, len);
diff --git a/perl.h b/perl.h
index 1335096..9de1291 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1126,7 +1126,8 @@ int sockatmark(int);
 #endif
 
 #define ERRSV GvSV(PL_errgv)
-#define DEFSV GvSV(PL_defgv)
+/* FIXME? Change the assignments to PL_defgv to instantiate GvSV?  */
+#define DEFSV GvSVn(PL_defgv)
 #define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
 
 #define ERRHV GvHV(PL_errgv)   /* XXX unused, here for compatibility */
diff --git a/sv.c b/sv.c
index 3d12232..c217558 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -7566,17 +7566,21 @@ Perl_sv_reset(pTHX_ register const char *s, HV *stash)
                    continue;
                gv = (GV*)HeVAL(entry);
                sv = GvSV(gv);
-               if (SvTHINKFIRST(sv)) {
-                   if (!SvREADONLY(sv) && SvROK(sv))
-                       sv_unref(sv);
-                   continue;
-               }
-               SvOK_off(sv);
-               if (SvTYPE(sv) >= SVt_PV) {
-                   SvCUR_set(sv, 0);
-                   if (SvPVX_const(sv) != Nullch)
-                       *SvPVX(sv) = '\0';
-                   SvTAINT(sv);
+               if (sv) {
+                   if (SvTHINKFIRST(sv)) {
+                       if (!SvREADONLY(sv) && SvROK(sv))
+                           sv_unref(sv);
+                       /* XXX Is this continue a bug? Why should THINKFIRST
+                          exempt us from resetting arrays and hashes?  */
+                       continue;
+                   }
+                   SvOK_off(sv);
+                   if (SvTYPE(sv) >= SVt_PV) {
+                       SvCUR_set(sv, 0);
+                       if (SvPVX_const(sv) != Nullch)
+                           *SvPVX(sv) = '\0';
+                       SvTAINT(sv);
+                   }
                }
                if (GvAV(gv)) {
                    av_clear(GvAV(gv));