summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-11 11:52:35 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-11 12:35:29 -0700
commitd6987b29f912081782fccc06b6e339e0bfd2ca6d (patch)
treef244e73862394070cd7243c34a79d9c95eafe17c /sv.c
parentf41cee3d84ebc90fe30f9ea9760e9a41a1a7ee2d (diff)
downloadperl-d6987b29f912081782fccc06b6e339e0bfd2ca6d.tar.gz
sv_reset: Don’t skip THINKFIRST items
Commit 9e35f4b3b4 made sv_reset skip SVs other than refs that had SvTHINKFIRST set. Back then SvTHINKFIRST was only true for refe- rences and read-only variables, so this change was technically cor- rect (except for skipping arrays and hashes, which this commit does not fix). But SvTHINKFIRST was expanded later (beginning in commit 6fc926691, by the author of 9e35f4b3b4), making this code in sv_reset wrong. In all fairness, it was already wrong before for things marked FAKE, just differently wrong.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 2cb036eb39..a86171646e 100644
--- a/sv.c
+++ b/sv.c
@@ -9148,13 +9148,11 @@ Perl_sv_resetpvn(pTHX_ const char *s, STRLEN len, HV * const stash)
gv = MUTABLE_GV(HeVAL(entry));
sv = GvSV(gv);
if (sv) {
- if (SvTHINKFIRST(sv)) {
- if (!SvREADONLY(sv) && SvROK(sv))
- sv_unref(sv);
+ if (SvREADONLY(sv))
/* XXX Is this continue a bug? Why should THINKFIRST
exempt us from resetting arrays and hashes? */
continue;
- }
+ SV_CHECK_THINKFIRST_COW_DROP(sv);
SvOK_off(sv);
if (SvTYPE(sv) >= SVt_PV) {
SvCUR_set(sv, 0);