From 54ca894738d71b8a053b5405699c66b8c0bd346d Mon Sep 17 00:00:00 2001 From: Richard Leach Date: Mon, 28 Nov 2022 13:28:46 +0000 Subject: Replace SvGROW with sv_grow_fresh in perl.c, pp_sys.c, toke.c Changed: * perl.c - Perl_moreswitches * pp_sys.c - pp_sysread * toke.c - Perl_scan_str In each of the above functions, one instance of SvGROW on a new SVt_PV can be swapped for the more efficient sv_grow_fresh. In two of the instances, the calls used to create the the SVt_PV have also been streamlined. There should not be any functional change as a result of this commit. --- perl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'perl.c') diff --git a/perl.c b/perl.c index 8ce14c67af..835d77e771 100644 --- a/perl.c +++ b/perl.c @@ -3554,8 +3554,8 @@ Perl_moreswitches(pTHX_ const char *s) numlen = 0; s--; } - PL_rs = newSVpvs(""); - tmps = (U8*) SvGROW(PL_rs, (STRLEN)(UVCHR_SKIP(rschar) + 1)); + PL_rs = newSV((STRLEN)(UVCHR_SKIP(rschar) + 1)); + tmps = (U8*)SvPVCLEAR_FRESH(PL_rs); uvchr_to_utf8(tmps, rschar); SvCUR_set(PL_rs, UVCHR_SKIP(rschar)); SvUTF8_on(PL_rs); -- cgit v1.2.1