home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
perl501m.zip
/
patches
/
patch.1a
next >
Wrap
Text File
|
1995-04-20
|
8KB
|
294 lines
# This is my patch patch.1a for perl5.001. See description below.
# Andy Dougherty doughera@lafcol.lafayette.edu
exit 0 # Just in case
This is my patch patch.1a for perl5.001.
[Actually, that's a lie. This is just Larry's four posted patches
bundled together. I've just usurped the letter 'a' to start my
patch sequence. You probably have already applied these, but now you
have a label for them, and we all know where we stand. ]
To apply, change to your perl directory,
and apply with
patch -p < thispatch.
Patch and enjoy,
Andy Dougherty doughera@lafcol.lafayette.edu
Dept. of Physics
Lafayette College, Easton PA
From lwall@scalpel.netlabs.com Wed Mar 15 09:01:46 1995
Date: Tue, 14 Mar 95 15:25:31 -0800
From: Larry Wall <lwall@scalpel.netlabs.com>
To: Carl Witty <cwitty@ai.mit.edu>
Cc: perl5-porters@africa.nicoh.com
Subject: Re: memory leaks in closures
Okay, here's your official unofficial closure leak patch.
*** op.c Mon Mar 13 15:03:34 1995
--- work/op.c Tue Mar 14 15:03:36 1995
***************
*** 2683,2689 ****
comppadlist = newAV();
AvREAL_off(comppadlist);
av_store(comppadlist, 0, SvREFCNT_inc((SV*)protopad_name));
! av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
CvPADLIST(cv) = comppadlist;
av_extend(comppad, AvFILL(protopad));
curpad = AvARRAY(comppad);
--- 2683,2689 ----
comppadlist = newAV();
AvREAL_off(comppadlist);
av_store(comppadlist, 0, SvREFCNT_inc((SV*)protopad_name));
! av_store(comppadlist, 1, (SV*)comppad);
CvPADLIST(cv) = comppadlist;
av_extend(comppad, AvFILL(protopad));
curpad = AvARRAY(comppad);
*** pp.c Fri Mar 10 21:34:06 1995
--- work/pp.c Tue Mar 14 09:38:16 1995
***************
*** 270,276 ****
EXTEND(SP,1);
if (SvFLAGS(cv) & SVpcv_CLONE) {
! cv = cv_clone(cv);
}
PUSHs((SV*)cv);
--- 270,276 ----
EXTEND(SP,1);
if (SvFLAGS(cv) & SVpcv_CLONE) {
! cv = (CV*)sv_2mortal((SV*)cv_clone(cv));
}
PUSHs((SV*)cv);
Larry
>From lwall@scalpel.netlabs.com Tue Mar 14 10:45:48 1995
Date: Mon, 13 Mar 95 15:55:18 -0800
From: Larry Wall <lwall@scalpel.netlabs.com>
To: "Stephen O. Lidie" <lusol@turkey.cc.lehigh.edu>
Cc: perl5-porters@africa.nicoh.com
Subject: Re: 5.001, findlex patch
: There were some warnings (AIX, xlc compiler):
Here's a cleaner version of the official unofficial patch, based on 5.001.
*** op.c@@/V5.001 Sun Mar 12 18:37:21 1995
--- op.c Mon Mar 13 15:03:34 1995
***************
*** 118,123 ****
--- 118,124 ----
}
static PADOFFSET
+ #ifndef CAN_PROTOTYPE
pad_findlex(name, newoff, seq, startcv, cx_ix)
char *name;
PADOFFSET newoff;
***************
*** 124,129 ****
--- 125,133 ----
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,2643 ****
--- 2642,2649 ----
}
SvREFCNT_dec(CvGV(cv));
CvGV(cv) = Nullgv;
+ SvREFCNT_dec(CvOUTSIDE(cv));
+ CvOUTSIDE(cv) = Nullcv;
LEAVE;
}
}
***************
*** 2669,2675 ****
CvSTASH(cv) = CvSTASH(proto);
CvROOT(cv) = CvROOT(proto);
CvSTART(cv) = CvSTART(proto);
! CvOUTSIDE(cv) = CvOUTSIDE(proto);
comppad = newAV();
--- 2675,2682 ----
CvSTASH(cv) = CvSTASH(proto);
CvROOT(cv) = CvROOT(proto);
CvSTART(cv) = CvSTART(proto);
! if (CvOUTSIDE(proto))
! CvOUTSIDE(cv) = (CV*)SvREFCNT_inc((SV*)CvOUTSIDE(proto));
comppad = newAV();
***************
*** 2752,2757 ****
--- 2759,2765 ----
SvREFCNT_dec(CvGV(cv));
}
CvOUTSIDE(cv) = CvOUTSIDE(compcv);
+ CvOUTSIDE(compcv) = 0;
CvPADLIST(cv) = CvPADLIST(compcv);
SvREFCNT_dec(compcv);
}
*** sv.c@@/V5.001 Sun Mar 12 19:31:18 1995
--- sv.c Mon Mar 13 15:04:13 1995
***************
*** 3358,3363 ****
--- 3358,3364 ----
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;
*** toke.c@@/V5.001 Sun Mar 12 17:26:48 1995
--- toke.c Mon Mar 13 15:52:31 1995
***************
*** 4633,4638 ****
--- 4633,4641 ----
CV* outsidecv = compcv;
AV* comppadlist;
+ if (compcv) {
+ assert(SvTYPE(compcv) == SVt_PVCV);
+ }
save_I32(&subline);
save_item(subname);
SAVEINT(padix);
***************
*** 4665,4671 ****
av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
CvPADLIST(compcv) = comppadlist;
! CvOUTSIDE(compcv) = outsidecv;
return oldsavestack_ix;
}
--- 4668,4674 ----
av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
CvPADLIST(compcv) = comppadlist;
! CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)outsidecv);
return oldsavestack_ix;
}
>From lwall@scalpel.netlabs.com Tue Mar 14 10:51:24 1995
Date: Mon, 13 Mar 95 16:43:53 -0800
From: Larry Wall <lwall@scalpel.netlabs.com>
To: perl5@scalpel.netlabs.com
Subject: s/// memory leak in 5.001
In fixing another bug I installed a nasty memory leak in s///. Here's the fix.
Larry
*** pp_hot.c Mon Mar 6 20:55:34 1995
--- work/pp_hot.c Mon Mar 13 16:21:54 1995
***************
*** 1451,1456 ****
--- 1451,1457 ----
safebase));
sv_catpvn(dstr, s, strend - s);
+ Safefree(SvPVX(TARG));
SvPVX(TARG) = SvPVX(dstr);
SvCUR_set(TARG, SvCUR(dstr));
SvLEN_set(TARG, SvLEN(dstr));
*** pp_ctl.c Mon Mar 6 20:42:19 1995
--- work/pp_ctl.c Mon Mar 13 16:22:12 1995
***************
*** 114,119 ****
--- 114,120 ----
SV *targ = cx->sb_targ;
sv_catpvn(dstr, s, cx->sb_strend - s);
+ Safefree(SvPVX(targ));
SvPVX(targ) = SvPVX(dstr);
SvCUR_set(targ, SvCUR(dstr));
SvLEN_set(targ, SvLEN(dstr));
>From lwall@scalpel.netlabs.com Wed Mar 15 14:04:32 1995
Date: Wed, 15 Mar 95 08:34:28 -0800
From: Larry Wall <lwall@scalpel.netlabs.com>
To: "Jack R. Lawler" <lawler@acsu.buffalo.edu>
Cc: perl5-porters@africa.nicoh.com
Subject: Re: 5.001 bug in print
: In perl 5.001 the print function now only outputs one significant digit for the
: the results of some mathematical functions.
:
: $ cat mine
: #!/usr/bin/perl
: print sqrt(2), "\n";
: print 4 * atan2(1,1), "\n";
: print log(2), "\n";
: $ ./mine
: 1
: 3
: 0
Okay, I understand how this one happened. This is a case where a
beneficial fix uncovered a bug elsewhere. I changed the constant
folder to prefer integer results over double if the numbers are the
same. In this case, they aren't, but it leaves the integer value there
anyway because the storage is already allocated for it, and it *might*
be used in an integer context. And since it's producing a constant, it
sets READONLY. Unfortunately, sv_2pv() bogusly preferred the integer
value to the double when READONLY was set. This never showed up if you
just said
print 1.4142135623731;
because in that case, there was already a string value. Here's the patch:
*** sv.c Mon Mar 13 15:04:13 1995
--- work/sv.c Wed Mar 15 08:27:16 1995
***************
*** 1246,1257 ****
return s;
}
if (SvREADONLY(sv)) {
- if (SvIOKp(sv)) {
- (void)sprintf(tokenbuf,"%ld",(long)SvIVX(sv));
- goto tokensave;
- }
if (SvNOKp(sv)) {
Gconvert(SvNVX(sv), DBL_DIG, 0, tokenbuf);
goto tokensave;
}
if (dowarn)
--- 1246,1257 ----
return s;
}
if (SvREADONLY(sv)) {
if (SvNOKp(sv)) {
Gconvert(SvNVX(sv), DBL_DIG, 0, tokenbuf);
+ goto tokensave;
+ }
+ if (SvIOKp(sv)) {
+ (void)sprintf(tokenbuf,"%ld",(long)SvIVX(sv));
goto tokensave;
}
if (dowarn)
Larry