summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2021-11-24 19:10:05 +0000
committerTony Cook <tony@develop-help.com>2021-11-29 10:07:19 +1100
commitc80a8618143e98aed6d9e5bbaee16d0308e211d0 (patch)
tree8ec167ae5402f841d06ff850da52458dabc94e17 /perlio.c
parenteb87cedb600ef8f1265ce27b13197ca7cbc33297 (diff)
downloadperl-c80a8618143e98aed6d9e5bbaee16d0308e211d0.tar.gz
newSVpvn_flags(x, .. ,SVs_TEMP) more efficient than sv_2mortal(newSVpv(x,0))
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/perlio.c b/perlio.c
index b972b2f9cd..cf43c40668 100644
--- a/perlio.c
+++ b/perlio.c
@@ -4899,7 +4899,7 @@ PerlIO *
PerlIO_open(const char *path, const char *mode)
{
dTHX;
- SV *name = sv_2mortal(newSVpv(path, 0));
+ SV *name = newSVpvn_flags(path, path == NULL ? 0 : strlen(path), SVs_TEMP);
return PerlIO_openn(aTHX_ NULL, mode, -1, 0, 0, NULL, 1, &name);
}
@@ -4908,7 +4908,7 @@ PerlIO *
PerlIO_reopen(const char *path, const char *mode, PerlIO *f)
{
dTHX;
- SV *name = sv_2mortal(newSVpv(path,0));
+ SV *name = newSVpvn_flags(path, path == NULL ? 0 : strlen(path), SVs_TEMP);
return PerlIO_openn(aTHX_ NULL, mode, -1, 0, 0, f, 1, &name);
}