From: Nicholas Clark Date: Mon, 5 Jul 2010 09:32:38 +0000 (+0100) Subject: In pp_regcomp and pp_entereval, use newSVpvn_flags() to simplify code. X-Git-Tag: accepted/trunk/20130322.191538~8540 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0479a84af089da76e98ee45ec853b871201b9fac;p=platform%2Fupstream%2Fperl.git In pp_regcomp and pp_entereval, use newSVpvn_flags() to simplify code. --- diff --git a/pp_ctl.c b/pp_ctl.c index ccda760..1525789 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -216,14 +216,7 @@ PP(pp_regcomp) } else if (SvAMAGIC(tmpstr)) { /* make a copy to avoid extra stringifies */ - SV* copy = newSV_type(SVt_PV); - sv_setpvn(copy, t, len); - if (SvUTF8(tmpstr)) - SvUTF8_on(copy); - else - SvUTF8_off(copy); - sv_2mortal(copy); - tmpstr = copy; + tmpstr = newSVpvn_flags(t, len, SVs_TEMP | SvUTF8(tmpstr)); } if (eng) @@ -3777,10 +3770,10 @@ PP(pp_entereval) /* make sure we've got a plain PV (no overload etc) before testing * for taint. Making a copy here is probably overkill, but better * safe than sorry */ - SV* tmpsv = newSV_type(SVt_PV); - sv_copypv(tmpsv, sv); - sv_2mortal(tmpsv); - sv = tmpsv; + STRLEN len; + const char * const p = SvPV_const(sv, len); + + sv = newSVpvn_flags(p, len, SVs_TEMP | SvUTF8(sv)); } TAINT_IF(SvTAINTED(sv));