Assimilate Cwd 2.15 from CPAN
[p5sagit/p5-mst-13.2.git] / sv.c
diff --git a/sv.c b/sv.c
index 6e64702..dd15758 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1455,6 +1455,11 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
        LvTARGLEN(sv)   = 0;
        LvTARG(sv)      = 0;
        LvTYPE(sv)      = 0;
+       GvGP(sv)        = 0;
+       GvNAME(sv)      = 0;
+       GvNAMELEN(sv)   = 0;
+       GvSTASH(sv)     = 0;
+       GvFLAGS(sv)     = 0;
        break;
     case SVt_PVAV:
        SvANY(sv) = new_XPVAV();
@@ -3783,7 +3788,9 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
            if (dtype != SVt_PVGV) {
                char *name = GvNAME(sstr);
                STRLEN len = GvNAMELEN(sstr);
-               sv_upgrade(dstr, SVt_PVGV);
+               /* don't upgrade SVt_PVLV: it can hold a glob */
+               if (dtype != SVt_PVLV)
+                   sv_upgrade(dstr, SVt_PVGV);
                sv_magic(dstr, dstr, PERL_MAGIC_glob, Nullch, 0);
                GvSTASH(dstr) = (HV*)SvREFCNT_inc(GvSTASH(sstr));
                GvNAME(dstr) = savepvn(name, len);
@@ -9507,6 +9514,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
            continue;   /* not "break" */
        }
 
+       /* calculate width before utf8_upgrade changes it */
+       have = esignlen + zeros + elen;
+
        if (is_utf8 != has_utf8) {
             if (is_utf8) {
                  if (SvCUR(sv))
@@ -9530,7 +9540,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
                "Newline in left-justified string for %sprintf",
                        (PL_op->op_type == OP_PRTF) ? "" : "s");
        
-       have = esignlen + zeros + elen;
        need = (have > width ? have : width);
        gap = need - have;
 
@@ -11287,7 +11296,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_egid            = proto_perl->Iegid;
     PL_nomemok         = proto_perl->Inomemok;
     PL_an              = proto_perl->Ian;
-    PL_op_seqmax       = proto_perl->Iop_seqmax;
     PL_evalseq         = proto_perl->Ievalseq;
     PL_origenviron     = proto_perl->Iorigenviron;     /* XXX not quite right */
     PL_origalen                = proto_perl->Iorigalen;
@@ -11466,14 +11474,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_last_swash_tmps = (U8*)NULL;
     PL_last_swash_slen = 0;
 
-    /* perly.c globals */
-    PL_yydebug         = proto_perl->Iyydebug;
-    PL_yynerrs         = proto_perl->Iyynerrs;
-    PL_yyerrflag       = proto_perl->Iyyerrflag;
-    PL_yychar          = proto_perl->Iyychar;
-    PL_yyval           = proto_perl->Iyyval;
-    PL_yylval          = proto_perl->Iyylval;
-
     PL_glob_index      = proto_perl->Iglob_index;
     PL_srand_called    = proto_perl->Isrand_called;
     PL_hash_seed       = proto_perl->Ihash_seed;