summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2021-11-23 23:35:58 +0000
committerTony Cook <tony@develop-help.com>2021-11-29 10:11:45 +1100
commit2a98b8cbbc6f75b5aaefb10acc4da4427359fcea (patch)
tree8a80adaddccc882df24d9656979b67aa8daeba95 /op.c
parentc80a8618143e98aed6d9e5bbaee16d0308e211d0 (diff)
downloadperl-2a98b8cbbc6f75b5aaefb10acc4da4427359fcea.tar.gz
newSVpvn_flags().. is more efficient than sv_2mortal(newSVpvn(..))
The same holds for newSVpvs* wrappers around newSVpvn* functions.
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/op.c b/op.c
index 3c5079ab4d..abf1a81031 100644
--- a/op.c
+++ b/op.c
@@ -10934,9 +10934,9 @@ S_already_defined(pTHX_ CV *const cv, OP * const block, OP * const o,
const line_t oldline = CopLINE(PL_curcop);
SV *namesv = o
? cSVOPo->op_sv
- : sv_2mortal(newSVpvn_utf8(
- PadnamePV(name)+1,PadnameLEN(name)-1, PadnameUTF8(name)
- ));
+ : newSVpvn_flags( PadnamePV(name)+1,PadnameLEN(name)-1,
+ (PadnameUTF8(name)) ? SVf_UTF8|SVs_TEMP : SVs_TEMP
+ );
if (PL_parser && PL_parser->copline != NOLINE)
/* This ensures that warnings are reported at the first
line of a redefinition, not the last. */