summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-05-29 20:39:33 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-05-29 20:39:51 -0700
commitb2b7346bfc59caff514d997701e0e086b983c863 (patch)
tree89ae20361692e532f68e1250a49641e730fa9e32 /universal.c
parent3259388b9b72d07a50fa1de8a5c6c1764a8e7584 (diff)
downloadperl-b2b7346bfc59caff514d997701e0e086b983c863.tar.gz
2nd try: [perl #91834] utf8::decode does not respect copy-on-write
I reverted the first version of this patch because I put the if() statement before a declaration. I did a revert, rather than a correc- tion, to make back-porting easier.
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/universal.c b/universal.c
index 145d860bc6..a8113d0e6c 100644
--- a/universal.c
+++ b/universal.c
@@ -695,7 +695,9 @@ XS(XS_utf8_decode)
croak_xs_usage(cv, "sv");
else {
SV * const sv = ST(0);
- const bool RETVAL = sv_utf8_decode(sv);
+ bool RETVAL;
+ if (SvIsCOW(sv)) sv_force_normal(sv);
+ RETVAL = sv_utf8_decode(sv);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}