perlio.c: (Coverity) eliminate temp ptr that confuses Coverity into thinking there...
[p5sagit/p5-mst-13.2.git] / sv.c
diff --git a/sv.c b/sv.c
index 3b9dfb8..8e90234 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10578,9 +10578,11 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            i = POPINT(ss,ix);
            TOPINT(nss,ix) = i;
            ptr = POPPTR(ss,ix);
-           HINTS_REFCNT_LOCK;
-           ((COP *)ptr)->cop_hints->refcounted_he_refcnt++;
-           HINTS_REFCNT_UNLOCK;
+           if (ptr) {
+               HINTS_REFCNT_LOCK;
+               ((struct refcounted_he *)ptr)->refcounted_he_refcnt++;
+               HINTS_REFCNT_UNLOCK;
+           }
            TOPPTR(nss,ix) = ptr;
            if (i & HINT_LOCALIZE_HH) {
                hv = (HV*)POPPTR(ss,ix);
@@ -10629,8 +10631,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
                    = pv_dup(old_state->re_state_bostr);
                new_state->re_state_reginput
                    = pv_dup(old_state->re_state_reginput);
-               new_state->re_state_regbol
-                   = pv_dup(old_state->re_state_regbol);
                new_state->re_state_regeol
                    = pv_dup(old_state->re_state_regeol);
                new_state->re_state_regstartp
@@ -10642,8 +10642,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
                new_state->re_state_reglastcloseparen
                    = any_dup(old_state->re_state_reglastcloseparen,
                              proto_perl);
-               new_state->re_state_regtill
-                   = pv_dup(old_state->re_state_regtill);
                /* XXX This just has to be broken. The old save_re_context
                   code did SAVEGENERICPV(PL_reg_start_tmp);
                   PL_reg_start_tmp is char **.
@@ -10657,10 +10655,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
                /* I assume that it only ever "worked" because no-one called
                   (pseudo)fork while the regexp engine had re-entered itself.
                */
-               new_state->re_state_reg_ganch
-                   = pv_dup(old_state->re_state_reg_ganch);
-               new_state->re_state_reg_sv
-                   = sv_dup(old_state->re_state_reg_sv, param);
 #ifdef PERL_OLD_COPY_ON_WRITE
                new_state->re_state_nrs
                    = sv_dup(old_state->re_state_nrs, param);
@@ -10681,6 +10675,22 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
 #endif
                break;
            }
+       case SAVEt_COP_WARNINGS:
+           {
+               void *optr = POPPTR(ss,ix);
+               TOPPTR(nss,ix) = ptr = any_dup(optr, proto_perl);
+               if (ptr != optr) {
+                   /* We duped something in the interpreter structure.  */
+                   ptr = POPPTR(ss,ix);
+                   TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr);
+               } else {
+                   /* I don't think that this happens, but it would mean that
+                      we (didn't) dup something shared.  */
+                   ptr = POPPTR(ss,ix);
+                   TOPPTR(nss,ix) = ptr;
+               }
+           }
+           break;
        default:
            Perl_croak(aTHX_ "panic: ss_dup inconsistency (%"IVdf")", (IV) i);
        }