summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-04-03 17:43:23 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-04-03 17:43:23 +0000
commit6fc9266916f08dacf1850556174b6312eefb14e6 (patch)
treed71efb2e3d8f34d5a58289c3b086d9c3695a79d4 /pp.c
parent9ec26bd9beab1b3c385bfa1981766ac62a926a52 (diff)
downloadperl-6fc9266916f08dacf1850556174b6312eefb14e6.tar.gz
remove duplicate code and an extra branch in sv_setsv() and
other hot code by making SvTHINKFIRST() think about FAKE SVs p4raw-id: //depot/perl@3213
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/pp.c b/pp.c
index b03acf3f9d..207a72dffc 100644
--- a/pp.c
+++ b/pp.c
@@ -792,15 +792,8 @@ PP(pp_undef)
if (!sv)
RETPUSHUNDEF;
- if (SvTHINKFIRST(sv)) {
- if (SvREADONLY(sv)) {
- dTHR;
- if (PL_curcop != &PL_compiling)
- croak(PL_no_modify);
- }
- if (SvROK(sv))
- sv_unref(sv);
- }
+ if (SvTHINKFIRST(sv))
+ sv_force_normal(sv);
switch (SvTYPE(sv)) {
case SVt_NULL:
@@ -817,9 +810,12 @@ PP(pp_undef)
CvANON((CV*)sv) ? "(anonymous)" : GvENAME(CvGV((CV*)sv)));
/* FALL THROUGH */
case SVt_PVFM:
- { GV* gv = (GV*)SvREFCNT_inc(CvGV((CV*)sv));
- cv_undef((CV*)sv);
- CvGV((CV*)sv) = gv; } /* let user-undef'd sub keep its identity */
+ {
+ /* let user-undef'd sub keep its identity */
+ GV* gv = (GV*)SvREFCNT_inc(CvGV((CV*)sv));
+ cv_undef((CV*)sv);
+ CvGV((CV*)sv) = gv;
+ }
break;
case SVt_PVGV:
if (SvFAKE(sv))
@@ -1037,12 +1033,6 @@ PP(pp_repeat)
STRLEN len;
tmpstr = POPs;
- if (TARG == tmpstr && SvTHINKFIRST(tmpstr)) {
- if (SvREADONLY(tmpstr) && PL_curcop != &PL_compiling)
- DIE("Can't x= to readonly value");
- if (SvROK(tmpstr))
- sv_unref(tmpstr);
- }
SvSetSV(TARG, tmpstr);
SvPV_force(TARG, len);
if (count != 1) {