summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-01-09 22:35:39 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-09 22:35:39 -0700
commit42e8dfb3ab42a8a8932761faad303588d6208a0a (patch)
tree08d42e3ee563051d372665b27bdf9c6474992e51
parent73bf5d85fed4a36555cccbb67e4aa1f84d8d130e (diff)
downloadperl-smoke-me/khw-invlist.tar.gz
Revert "Better fix for perl #107440"smoke-me/khw-invlist
This reverts commit 60edcf09a5cb026822f99270a4bfbe3149cfbb52.
-rw-r--r--av.c14
-rw-r--r--hv.c8
-rw-r--r--pp.c4
-rw-r--r--pp_hot.c10
4 files changed, 7 insertions, 29 deletions
diff --git a/av.c b/av.c
index 472600b6f0..1671f16e40 100644
--- a/av.c
+++ b/av.c
@@ -437,7 +437,6 @@ Perl_av_clear(pTHX_ register AV *av)
{
dVAR;
I32 extra;
- bool real;
PERL_ARGS_ASSERT_AV_CLEAR;
assert(SvTYPE(av) == SVt_PVAV);
@@ -463,11 +462,9 @@ Perl_av_clear(pTHX_ register AV *av)
if (AvMAX(av) < 0)
return;
- if ((real = !!AvREAL(av))) {
+ if (AvREAL(av)) {
SV** const ary = AvARRAY(av);
I32 index = AvFILLp(av) + 1;
- ENTER;
- SAVEFREESV(SvREFCNT_inc_simple_NN(av));
while (index) {
SV * const sv = ary[--index];
/* undef the slot before freeing the value, because a
@@ -482,7 +479,7 @@ Perl_av_clear(pTHX_ register AV *av)
AvARRAY(av) = AvALLOC(av);
}
AvFILLp(av) = -1;
- if (real) LEAVE;
+
}
/*
@@ -496,8 +493,6 @@ Undefines the array. Frees the memory used by the array itself.
void
Perl_av_undef(pTHX_ register AV *av)
{
- bool real;
-
PERL_ARGS_ASSERT_AV_UNDEF;
assert(SvTYPE(av) == SVt_PVAV);
@@ -505,10 +500,8 @@ Perl_av_undef(pTHX_ register AV *av)
if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied))
av_fill(av, -1);
- if ((real = !!AvREAL(av))) {
+ if (AvREAL(av)) {
register I32 key = AvFILLp(av) + 1;
- ENTER;
- SAVEFREESV(SvREFCNT_inc_simple_NN(av));
while (key)
SvREFCNT_dec(AvARRAY(av)[--key]);
}
@@ -519,7 +512,6 @@ Perl_av_undef(pTHX_ register AV *av)
AvMAX(av) = AvFILLp(av) = -1;
if(SvRMAGICAL(av)) mg_clear(MUTABLE_SV(av));
- if(real) LEAVE;
}
/*
diff --git a/hv.c b/hv.c
index 2cfe25bb4d..af41de8691 100644
--- a/hv.c
+++ b/hv.c
@@ -1681,20 +1681,12 @@ S_hfreeentries(pTHX_ HV *hv)
STRLEN index = 0;
XPVHV * const xhv = (XPVHV*)SvANY(hv);
SV *sv;
- const bool save = !!SvREFCNT(hv);
PERL_ARGS_ASSERT_HFREEENTRIES;
- if (save) {
- ENTER;
- SAVEFREESV(SvREFCNT_inc_simple_NN(hv));
- }
-
while ((sv = Perl_hfree_next_entry(aTHX_ hv, &index))||xhv->xhv_keys) {
SvREFCNT_dec(sv);
}
-
- if (save) LEAVE;
}
diff --git a/pp.c b/pp.c
index eaf6a85277..5910e8691d 100644
--- a/pp.c
+++ b/pp.c
@@ -970,10 +970,10 @@ PP(pp_undef)
case SVt_NULL:
break;
case SVt_PVAV:
- av_undef(MUTABLE_AV(sv));
+ av_undef(MUTABLE_AV(sv_2mortal(SvREFCNT_inc_simple_NN(sv))));
break;
case SVt_PVHV:
- hv_undef(MUTABLE_HV(sv));
+ hv_undef(MUTABLE_HV(sv_2mortal(SvREFCNT_inc_simple_NN(sv))));
break;
case SVt_PVCV:
if (cv_const_sv((const CV *)sv))
diff --git a/pp_hot.c b/pp_hot.c
index ff834a924e..add940049b 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -993,10 +993,8 @@ PP(pp_aassign)
sv = *lelem++;
switch (SvTYPE(sv)) {
case SVt_PVAV:
- ary = MUTABLE_AV(sv);
+ ary = MUTABLE_AV(sv_2mortal(SvREFCNT_inc_simple_NN(sv)));
magic = SvMAGICAL(ary) != 0;
- ENTER;
- SAVEFREESV(SvREFCNT_inc_simple_NN(sv));
av_clear(ary);
av_extend(ary, lastrelem - relem);
i = 0;
@@ -1017,16 +1015,13 @@ PP(pp_aassign)
}
if (PL_delaymagic & DM_ARRAY_ISA)
SvSETMAGIC(MUTABLE_SV(ary));
- LEAVE;
break;
case SVt_PVHV: { /* normal hash */
SV *tmpstr;
SV** topelem = relem;
- hash = MUTABLE_HV(sv);
+ hash = MUTABLE_HV(sv_2mortal(SvREFCNT_inc_simple_NN(sv)));
magic = SvMAGICAL(hash) != 0;
- ENTER;
- SAVEFREESV(SvREFCNT_inc_simple_NN(sv));
hv_clear(hash);
firsthashrelem = relem;
@@ -1063,7 +1058,6 @@ PP(pp_aassign)
do_oddball(hash, relem, firstrelem);
relem++;
}
- LEAVE;
}
break;
default: