diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2022-08-25 13:51:15 +0000 |
---|---|---|
committer | Richard Leach <richardleach@users.noreply.github.com> | 2022-09-18 23:50:26 +0100 |
commit | 540f4522aa40f6672e5e44976a38fae4b39fa3b8 (patch) | |
tree | 9e2b94dfe5f24c159216f555bfd39cd815dfef08 | |
parent | b0b120dcf9fb7ade458e6d3d5903779ae11290f2 (diff) | |
download | perl-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.
-rw-r--r-- | toke.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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--; |