From: Nicholas Clark Date: Wed, 29 Jun 2005 19:25:24 +0000 (+0000) Subject: Fixes to -DPERL_DONT_CREATE_GVSV to make more tests pass X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e203899dcaadab28f2ff9e515fbc895686054f71;p=p5sagit%2Fp5-mst-13.2.git Fixes to -DPERL_DONT_CREATE_GVSV to make more tests pass p4raw-id: //depot/perl@25010 --- diff --git a/doio.c b/doio.c index a2300fc..b62a473 100644 --- 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 --- 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 --- 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 --- 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));