summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>2005-11-21 17:03:39 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-11-21 17:19:34 +0000
commit91cec4fb3b9ce703dab10db05e717127b2a9ed44 (patch)
tree564c6a5c1f3e2f13fa16bb17baf9013674a070f9 /pp_hot.c
parentb9502f15e71f884b7c2676e820cd89c0140698a1 (diff)
downloadperl-91cec4fb3b9ce703dab10db05e717127b2a9ed44.tar.gz
concat interacts badly with magic
Message-ID: <20051121170339.GA8214@rpc142.cs.man.ac.uk> p4raw-id: //depot/perl@26185
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 813b606b0b..8502c1c9a1 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -148,11 +148,14 @@ PP(pp_concat)
dPOPTOPssrl;
bool lbyte;
STRLEN rlen;
- const char *rpv = SvPV_const(right, rlen); /* mg_get(right) happens here */
- const bool rbyte = !DO_UTF8(right);
+ const char *rpv;
+ bool rbyte;
bool rcopied = FALSE;
if (TARG == right && right != left) {
+ /* mg_get(right) may happen here ... */
+ rpv = SvPV_const(right, rlen);
+ rbyte = !DO_UTF8(right);
right = sv_2mortal(newSVpvn(rpv, rlen));
rpv = SvPV_const(right, rlen); /* no point setting UTF-8 here */
rcopied = TRUE;
@@ -179,6 +182,11 @@ PP(pp_concat)
SvUTF8_off(TARG);
}
+ /* or mg_get(right) may happen here */
+ if (!rcopied) {
+ rpv = SvPV_const(right, rlen);
+ rbyte = !DO_UTF8(right);
+ }
if (lbyte != rbyte) {
if (lbyte)
sv_utf8_upgrade_nomg(TARG);