From: Steffen Mueller Date: Mon, 10 Feb 2014 10:40:31 +0000 (+0100) Subject: pp_concat: Only call SvPV_force_nolen when needed X-Git-Tag: upstream/5.20.0~446 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18ea7bf2cf79c90c0c3162783e5a0f30fbf0c026;p=platform%2Fupstream%2Fperl.git pp_concat: Only call SvPV_force_nolen when needed If we just did an sv_setpvs on it, the SvPV_force_nolen should not do anything useful, so let's not. Side note: s/TARG/left/ in the enclosing block because they are the same pointer, so why use a define that needs grokking by the reader of the code if the local variable is guaranteed to be the same? --- diff --git a/pp_hot.c b/pp_hot.c index beb9649..79b77ab 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -278,16 +278,18 @@ PP(pp_concat) else SvUTF8_off(TARG); } - else { /* $l .= $r */ - if (!SvOK(TARG)) { + else { /* $l .= $r and left == TARG */ + if (!SvOK(left)) { if (left == right && ckWARN(WARN_UNINITIALIZED)) /* $l .= $l */ report_uninit(right); sv_setpvs(left, ""); } - SvPV_force_nomg_nolen(left); + else { + SvPV_force_nomg_nolen(left); + } lbyte = !DO_UTF8(left); if (IN_BYTES) - SvUTF8_off(TARG); + SvUTF8_off(left); } if (!rcopied) {