supported platforms mixed up
[p5sagit/p5-mst-13.2.git] / sv.c
diff --git a/sv.c b/sv.c
index 8a86a92..3eebc9a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -4743,6 +4743,25 @@ Perl_newSViv(pTHX_ IV i)
 }
 
 /*
+=for apidoc newSVuv
+
+Creates a new SV and copies an unsigned integer into it.
+The reference count for the SV is set to 1.
+
+=cut
+*/
+
+SV *
+Perl_newSVuv(pTHX_ UV u)
+{
+    register SV *sv;
+
+    new_SV(sv);
+    sv_setuv(sv,u);
+    return sv;
+}
+
+/*
 =for apidoc newRV_noinc
 
 Creates an RV wrapper for an SV.  The reference count for the original
@@ -5168,6 +5187,7 @@ Perl_sv_reftype(pTHX_ SV *sv, int ob)
        case SVt_PVCV:          return "CODE";
        case SVt_PVGV:          return "GLOB";
        case SVt_PVFM:          return "FORMAT";
+       case SVt_PVIO:          return "IO";
        default:                return "UNKNOWN";
        }
     }
@@ -5809,6 +5829,8 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
                    vecsv = va_arg(*args, SV*);
                else if (svix < svmax)
                    vecsv = svargs[svix++];
+               else
+                   continue;
                dotstr = SvPVx(vecsv,dotstrlen);
                if (DO_UTF8(vecsv))
                    is_utf = TRUE;
@@ -5821,6 +5843,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
                    vecsv = va_arg(*args, SV*);
                else if (svix < svmax)
                    vecsv = svargs[svix++];
+               else {
+                   vecstr = (U8*)"";
+                   veclen = 0;
+                   continue;
+               }
                vecstr = (U8*)SvPVx(vecsv,veclen);
                utf = DO_UTF8(vecsv);
                continue;
@@ -6375,10 +6402,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
 #  include "error: USE_THREADS and USE_ITHREADS are incompatible"
 #endif
 
-#ifndef OpREFCNT_inc
-#  define OpREFCNT_inc(o)      ((o) ? (++(o)->op_targ, (o)) : Nullop)
-#endif
-
 #ifndef GpREFCNT_inc
 #  define GpREFCNT_inc(gp)     ((gp) ? (++(gp)->gp_refcnt, (gp)) : (GP*)NULL)
 #endif
@@ -6969,6 +6992,9 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max)
                ncx->blk_loop.iterdata  = (CxPADLOOP(cx)
                                           ? cx->blk_loop.iterdata
                                           : gv_dup((GV*)cx->blk_loop.iterdata));
+               ncx->blk_loop.oldcurpad
+                   = (SV**)ptr_table_fetch(PL_ptr_table,
+                                           cx->blk_loop.oldcurpad);
                ncx->blk_loop.itersave  = sv_dup_inc(cx->blk_loop.itersave);
                ncx->blk_loop.iterlval  = sv_dup_inc(cx->blk_loop.iterlval);
                ncx->blk_loop.iterary   = av_dup_inc(cx->blk_loop.iterary);
@@ -7080,6 +7106,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl)
     char *c;
     void (*dptr) (void*);
     void (*dxptr) (pTHXo_ void*);
+    OP *o;
 
     Newz(54, nss, max, ANY);
 
@@ -7206,7 +7233,9 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl)
                case OP_LEAVE:
                case OP_SCOPE:
                case OP_LEAVEWRITE:
-                   TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
+                   TOPPTR(nss,ix) = ptr;
+                   o = (OP*)ptr;
+                   OpREFCNT_inc(o);
                    break;
                default:
                    TOPPTR(nss,ix) = Nullop;
@@ -7549,7 +7578,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_main_cv         = cv_dup_inc(proto_perl->Imain_cv);
     PL_main_root       = OpREFCNT_inc(proto_perl->Imain_root);
     PL_main_start      = proto_perl->Imain_start;
-    PL_eval_root       = OpREFCNT_inc(proto_perl->Ieval_root);
+    PL_eval_root       = proto_perl->Ieval_root;
     PL_eval_start      = proto_perl->Ieval_start;
 
     /* runtime control stuff */