From 18ea7bf2cf79c90c0c3162783e5a0f30fbf0c026 Mon Sep 17 00:00:00 2001 From: Steffen Mueller Date: Mon, 10 Feb 2014 11:40:31 +0100 Subject: [PATCH] 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? --- pp_hot.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) { -- 2.7.4