cleaner version of the official unofficial patch
Larry Wall [Mon, 13 Mar 1995 23:55:18 +0000 (15:55 -0800)]
: There were some warnings (AIX, xlc compiler):

Here's a cleaner version of the official unofficial patch, based on 5.001.

op.c
sv.c
toke.c

diff --git a/op.c b/op.c
index b1f867f..8e66452 100644 (file)
--- a/op.c
+++ b/op.c
@@ -118,12 +118,16 @@ char *name;
 }
 
 static PADOFFSET
+#ifndef CAN_PROTOTYPE
 pad_findlex(name, newoff, seq, startcv, cx_ix)
 char *name;
 PADOFFSET newoff;
 I32 seq;
 CV* startcv;
 I32 cx_ix;
+#else
+pad_findlex(char *name, PADOFFSET newoff, I32 seq, CV* startcv, I32 cx_ix)
+#endif
 {
     CV *cv;
     I32 off;
@@ -2638,6 +2642,8 @@ CV *cv;
        }
        SvREFCNT_dec(CvGV(cv));
        CvGV(cv) = Nullgv;
+       SvREFCNT_dec(CvOUTSIDE(cv));
+       CvOUTSIDE(cv) = Nullcv;
        LEAVE;
     }
 }
@@ -2669,7 +2675,8 @@ CV* proto;
     CvSTASH(cv)                = CvSTASH(proto);
     CvROOT(cv)         = CvROOT(proto);
     CvSTART(cv)                = CvSTART(proto);
-    CvOUTSIDE(cv)      = CvOUTSIDE(proto);
+    if (CvOUTSIDE(proto))
+       CvOUTSIDE(cv)   = (CV*)SvREFCNT_inc((SV*)CvOUTSIDE(proto));
 
     comppad = newAV();
 
@@ -2752,6 +2759,7 @@ OP *block;
            SvREFCNT_dec(CvGV(cv));
        }
        CvOUTSIDE(cv) = CvOUTSIDE(compcv);
+       CvOUTSIDE(compcv) = 0;
        CvPADLIST(cv) = CvPADLIST(compcv);
        SvREFCNT_dec(compcv);
     }
diff --git a/sv.c b/sv.c
index 59e5cf7..350356a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3358,6 +3358,7 @@ SV* sv;
        fprintf(stderr, "  FILEGV = 0x%lx\n", (long)CvFILEGV(sv));
        fprintf(stderr, "  DEPTH = %ld\n", (long)CvDEPTH(sv));
        fprintf(stderr, "  PADLIST = 0x%lx\n", (long)CvPADLIST(sv));
+       fprintf(stderr, "  OUTSIDE = 0x%lx\n", (long)CvOUTSIDE(sv));
        if (type == SVt_PVFM)
            fprintf(stderr, "  LINES = %ld\n", (long)FmLINES(sv));
        break;
diff --git a/toke.c b/toke.c
index 99d0e61..783974e 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4633,6 +4633,9 @@ start_subparse()
     CV* outsidecv = compcv;
     AV* comppadlist;
 
+    if (compcv) {
+       assert(SvTYPE(compcv) == SVt_PVCV);
+    }
     save_I32(&subline);
     save_item(subname);
     SAVEINT(padix);
@@ -4665,7 +4668,7 @@ start_subparse()
     av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
 
     CvPADLIST(compcv) = comppadlist;
-    CvOUTSIDE(compcv) = outsidecv;
+    CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)outsidecv);
 
     return oldsavestack_ix;
 }