summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-08-25 13:51:15 +0000
committerRichard Leach <richardleach@users.noreply.github.com>2022-09-18 23:50:26 +0100
commit540f4522aa40f6672e5e44976a38fae4b39fa3b8 (patch)
tree9e2b94dfe5f24c159216f555bfd39cd815dfef08 /toke.c
parentb0b120dcf9fb7ade458e6d3d5903779ae11290f2 (diff)
downloadperl-540f4522aa40f6672e5e44976a38fae4b39fa3b8.tar.gz
S_scan_heredoc: fresh sv functions close to point of use
S_scan_heredoc does a SvGROW on a fresh PVIV. A sv_grow_fresh is more efficient, plus it seems only really needed in the nearby "else" branch. In the "if" branch, sv_setsv_fresh can be used directly.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 607ce0372a..a7601f3b3a 100644
--- a/toke.c
+++ b/toke.c
@@ -10777,7 +10777,6 @@ S_scan_heredoc(pTHX_ char *s)
#endif
tmpstr = newSV_type(SVt_PVIV);
- SvGROW(tmpstr, 80);
if (term == '\'') {
op_type = OP_CONST;
SvIV_set(tmpstr, -1);
@@ -10888,7 +10887,7 @@ S_scan_heredoc(pTHX_ char *s)
goto interminable;
}
- sv_setpvn(tmpstr,d+1,s-d);
+ sv_setpvn_fresh(tmpstr,d+1,s-d);
s += len - 1;
/* the preceding stmt passes a newline */
PL_parser->herelines++;
@@ -10935,6 +10934,7 @@ S_scan_heredoc(pTHX_ char *s)
char *oldbufptr_save;
char *oldoldbufptr_save;
streaming:
+ sv_grow_fresh(tmpstr, 80);
SvPVCLEAR(tmpstr); /* avoid "uninitialized" warning */
term = PL_tokenbuf[1];
len--;