diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-04-18 21:58:22 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-04-18 21:58:22 +0000 |
commit | 1da4ca5ff65374ad6965719e5eb33e3027a745a7 (patch) | |
tree | 378c39cf08d231c303fffa124644ea3300e1f46a /pp_hot.c | |
parent | b7e9a5c2d751f7ed3b8a703e57ac933ded5b16ce (diff) | |
download | perl-1da4ca5ff65374ad6965719e5eb33e3027a745a7.tar.gz |
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
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1624,8 +1624,7 @@ Perl_do_readline(pTHX) } if (gimme == G_ARRAY) { if (SvLEN(sv) - SvCUR(sv) > 20) { - SvLEN_set(sv, SvCUR(sv)+1); - SvPV_renew(sv, SvLEN(sv)); + SvPV_shrink_to_cur(sv); } sv = sv_2mortal(NEWSV(58, 80)); continue; @@ -1634,8 +1633,7 @@ Perl_do_readline(pTHX) /* try to reclaim a bit of scalar space (only on 1st alloc) */ const STRLEN new_len = SvCUR(sv) < 60 ? 80 : SvCUR(sv)+40; /* allow some slop */ - SvLEN_set(sv, new_len); - SvPV_renew(sv, SvLEN(sv)); + SvPV_renew(sv, new_len); } RETURN; } |