By swapping the order of pushes onto the save stack for
Nicholas Clark [Sat, 8 Apr 2006 14:46:53 +0000 (14:46 +0000)]
SAVEt_GENERIC_PVREF, we can merge it with SAVEt_PPTR in Perl_ss_dup().

p4raw-id: //depot/perl@27740

scope.c
sv.c

diff --git a/scope.c b/scope.c
index cec853e..be926c8 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -226,8 +226,8 @@ Perl_save_generic_pvref(pTHX_ char **str)
 {
     dVAR;
     SSCHECK(3);
-    SSPUSHPTR(str);
     SSPUSHPTR(*str);
+    SSPUSHPTR(str);
     SSPUSHINT(SAVEt_GENERIC_PVREF);
 }
 
@@ -643,8 +643,8 @@ Perl_leave_scope(pTHX_ I32 base)
                SvREFCNT_dec(av);
            break;
        case SAVEt_GENERIC_PVREF:               /* generic pv */
-           str = (char*)SSPOPPTR;
            ptr = SSPOPPTR;
+           str = (char*)SSPOPPTR;
            if (*(char**)ptr != str) {
                Safefree(*(char**)ptr);
                *(char**)ptr = str;
diff --git a/sv.c b/sv.c
index 612127f..63cef31 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10382,12 +10382,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            gv = (GV*)POPPTR(ss,ix);
            TOPPTR(nss,ix) = gv_dup_inc(gv, param);
            break;
-       case SAVEt_GENERIC_PVREF:               /* generic char* */
-           c = (char*)POPPTR(ss,ix);
-           TOPPTR(nss,ix) = pv_dup(c);
-           ptr = POPPTR(ss,ix);
-           TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
-           break;
        case SAVEt_SHARED_PVREF:                /* char* in shared space */
            c = (char*)POPPTR(ss,ix);
            TOPPTR(nss,ix) = savesharedpv(c);
@@ -10452,6 +10446,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
            break;
+       case SAVEt_GENERIC_PVREF:               /* generic char* */
        case SAVEt_PPTR:                        /* char* reference */
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);