summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-30 18:18:00 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-30 18:18:00 +0000
commitb63dd7f7caaa3d1449566c6b24400993048b7c63 (patch)
tree8329833f66518b2de5b51cbc998a50ddc7893d7c /mg.c
parent41b1fd7822e1b3975e4428b14f44a6d0c9b7715f (diff)
downloadperl-b63dd7f7caaa3d1449566c6b24400993048b7c63.tar.gz
Integrate:
[ 32686] Subject: mg_free frees data but leaves it accessible From: Yuval Kogman <nothingmuch@woobling.org> Message-ID: <20071220221331.GG10631@woobling.org> Date: Fri, 21 Dec 2007 00:13:31 +0200 [ 32743] You can't coerce a typeglob to a string. (Restore the error message - an assertion failure is not helpful). Test the 3 basic coercion error messages. [ 32754] Silly Nick. There was a bug in change 30757 whereby the precomp of a dup'd regexp would be pointing somewhere la-la. Probably at the precomp of the same regexp in the parent thread. (So it is only likely to go nasal daemon if the parent thread terminates first, or explicitly goes around freeing up run time generated regexps.) [ 32779] Subject: [PATCH] Typo in op.c From: Vincent Pit <perl@profvince.com> Message-ID: <47712BF1.9060200@profvince.com> Date: Tue, 25 Dec 2007 17:12:33 +0100 (And then an update to make the tests in gv.t expect the right thing, and test the behaviour that my change 26482 was originally supposed to produce, but didn't until this typo was fixed) [ 32874] Subject: [perl #49003] pp_ftrread appears to use the wrong access mode for -x when using "use filetest 'access';" From: pravus@cpan.org (via RT) <perlbug-followup@perl.org> Date: Fri, 21 Dec 2007 10:05:15 -0800 Message-ID: <rt-3.6.HEAD-22850-1198260315-255.49003-75-0@perl.org> [ 32906] change #31447 was wrong. Really handle cloning a stale lexical var [ 32932] Fix the bug introduced by the bug fix of change 30755. (Certain regexps could SEGV if cloned). [ 32935] Fix bug picked up by printf format warnings - a cast is needed where UV is larger than U32 for dumping leaking scalars. [ 32968] Fix bug whereby length on a tied scalar that returned a UTF-8 value would not be correct the first time. (And for the more pathological case, would be incorrect if the UTF-8-ness of the returned value changed.) [ 33026] When changing the op_ppaddr of an op, one must keep its op_type in sync. That helps writers of alternate runloops. [ 33033] In pp_subst, rxtainted is not a boolean, as it stores 2 bits of values. p4raw-link: @33033 on //depot/perl: 99710fe38e53c8e763d4758979c48cc5bc8503cf p4raw-link: @33026 on //depot/perl: 377b1098958349a561ae80eec0745a3418c2ddb4 p4raw-link: @32968 on //depot/perl: d06445298904613950b0410a2f3b1125ab58c7b5 p4raw-link: @32935 on //depot/perl: 574b88211c0c7c08c099f0fa17b950a4aaf1c62f p4raw-link: @32932 on //depot/perl: 66b1de870892b142348d95c3a6c21c7ff7269508 p4raw-link: @32906 on //depot/perl: 33894c1aa3e715f48f9d6f591dc779d058e6329b p4raw-link: @32874 on //depot/perl: b376053de54af4268a31e5a60d1f9e57db30af11 p4raw-link: @32779 on //depot/perl: 50baa5ea2240b5b5f0f2d876ef7d68fbb74f49e4 p4raw-link: @32754 on //depot/perl: 3a9b2cacfb08e1181b7d9ae45cad1ed8acd59972 p4raw-link: @32743 on //depot/perl: 1f257c956c5d42ce792dd5e0f3badf9851cef49c p4raw-link: @32686 on //depot/perl: c826f41b69925b8dedc613995e7dbb5bc467e6a4 p4raw-link: @31447 on //depot/perl: efa785391fea9e6aff4c999b27ad62b7d8f9ea99 p4raw-id: //depot/maint-5.10/perl@33132 p4raw-branched: from //depot/perl@33131 'branch in' t/uni/tie.t p4raw-integrated: from //depot/perl@33131 'copy in' t/op/closure.t (@31448..) 'edit in' mg.c (@32948..) p4raw-integrated: from //depot/perl@33033 'merge in' pp_hot.c (@33017..) p4raw-integrated: from //depot/perl@33026 'edit in' perl.c (@33025..) p4raw-integrated: from //depot/perl@32968 'copy in' t/op/length.t (@19961..) 'merge in' MANIFEST (@32954..) p4raw-integrated: from //depot/perl@32932 'ignore' t/op/pat.t (@32931..) p4raw-integrated: from //depot/perl@32906 'copy in' pad.c (@31835..) p4raw-integrated: from //depot/perl@32874 'merge in' pp_sys.c (@32822..) p4raw-integrated: from //depot/perl@32779 'merge in' op.c (@32753..) p4raw-integrated: from //depot/perl@32754 'edit in' regcomp.c (@32753..) p4raw-integrated: from //depot/perl@32743 'ignore' t/op/gv.t (@31940..) 'merge in' sv.c (@32740..)
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mg.c b/mg.c
index f59f5c57e2..53e3bedcf1 100644
--- a/mg.c
+++ b/mg.c
@@ -308,12 +308,15 @@ Perl_mg_length(pTHX_ SV *sv)
}
}
- if (DO_UTF8(sv)) {
+ {
+ /* You can't know whether it's UTF-8 until you get the string again...
+ */
const U8 *s = (U8*)SvPV_const(sv, len);
- len = utf8_length(s, s + len);
+
+ if (DO_UTF8(sv)) {
+ len = utf8_length(s, s + len);
+ }
}
- else
- (void)SvPV_const(sv, len);
return len;
}
@@ -497,6 +500,7 @@ Perl_mg_free(pTHX_ SV *sv)
if (mg->mg_flags & MGf_REFCOUNTED)
SvREFCNT_dec(mg->mg_obj);
Safefree(mg);
+ SvMAGIC_set(sv, moremagic);
}
SvMAGIC_set(sv, NULL);
return 0;