From 1da4ca5ff65374ad6965719e5eb33e3027a745a7 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 18 Apr 2005 21:58:22 +0000 Subject: SvPV_renew also calls SvLEN_set Add SvPV_shrink_to_cur(sv) to call SvPV_renew with SvCUR(sv)+1. For Ponie this can be a single call into the PMC p4raw-id: //depot/perl@24245 --- toke.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'toke.c') diff --git a/toke.c b/toke.c index 55180788bf..352254f0ab 100644 --- a/toke.c +++ b/toke.c @@ -1825,8 +1825,7 @@ S_scan_const(pTHX_ char *start) /* shrink the sv if we allocated more than we used */ if (SvCUR(sv) + 5 < SvLEN(sv)) { - SvLEN_set(sv, SvCUR(sv) + 1); - SvPV_renew(sv, SvLEN(sv)); + SvPV_shrink_to_cur(sv); } /* return the substring (via yylval) only if we parsed anything */ @@ -9603,8 +9602,7 @@ S_scan_heredoc(pTHX_ register char *s) retval: PL_multi_end = CopLINE(PL_curcop); if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) { - SvLEN_set(tmpstr, SvCUR(tmpstr) + 1); - SvPV_renew(tmpstr, SvLEN(tmpstr)); + SvPV_shrink_to_cur(tmpstr); } SvREFCNT_dec(herewas); if (!IN_BYTES) { @@ -10975,3 +10973,12 @@ Perl_scan_vstring(pTHX_ const char *s, SV *sv) return (char *)s; } +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * vim: shiftwidth=4: +*/ -- cgit v1.2.1