diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-05 10:32:38 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-05 10:32:38 +0100 |
commit | 0479a84af089da76e98ee45ec853b871201b9fac (patch) | |
tree | 61204044ad74faa2d6042ba4e80586b822215c47 /pp_ctl.c | |
parent | f3227b742bc4dd157ecfe2b66fd38e4bb610a4a1 (diff) | |
download | perl-0479a84af089da76e98ee45ec853b871201b9fac.tar.gz |
In pp_regcomp and pp_entereval, use newSVpvn_flags() to simplify code.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -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)); |