From: Simon Cozens Date: Tue, 10 Oct 2000 17:40:17 +0000 (+0100) Subject: Re: utf8 concat, mg_get X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82f2f50342294af2f0534f1cc5ea55eb042b13e2;p=p5sagit%2Fp5-mst-13.2.git Re: utf8 concat, mg_get Message-ID: <20001010174017.A13130@pembro4.pmb.ox.ac.uk> p4raw-id: //depot/perl@7190 --- diff --git a/pp_hot.c b/pp_hot.c index 7d39514..d5cffe5 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -146,9 +146,17 @@ PP(pp_concat) dPOPTOPssrl; STRLEN len; U8 *s; - bool left_utf = DO_UTF8(left); - bool right_utf = DO_UTF8(right); + bool left_utf; + bool right_utf; + if (TARG == right && SvGMAGICAL(right)) + mg_get(right); + if (SvGMAGICAL(left)) + mg_get(left); + + left_utf = DO_UTF8(left); + right_utf = DO_UTF8(right); + if (left_utf != right_utf) { if (TARG == right && !right_utf) { sv_utf8_upgrade(TARG); /* Now straight binary copy */ @@ -163,9 +171,7 @@ PP(pp_concat) /* Take a copy since we're about to overwrite TARG */ olds = s = (U8*)savepvn((char*)s, len); } - if (SvGMAGICAL(left)) - mg_get(left); - else if (!SvOK(left) && SvTYPE(left) <= SVt_PVMG) + if (!SvOK(left) && SvTYPE(left) <= SVt_PVMG) sv_setpv(left, ""); /* Suppress warning. */ l = (U8*)SvPV(left, targlen); if (TARG != left) @@ -207,8 +213,6 @@ PP(pp_concat) } sv_setpvn(TARG, (char *)s, len); } - else if (SvGMAGICAL(TARG)) - mg_get(TARG); else if (!SvOK(TARG) && SvTYPE(TARG) <= SVt_PVMG) sv_setpv(TARG, ""); /* Suppress warning. */ s = (U8*)SvPV(right,len);