summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-04-18 21:58:22 +0000
committerNicholas Clark <nick@ccl4.org>2005-04-18 21:58:22 +0000
commit1da4ca5ff65374ad6965719e5eb33e3027a745a7 (patch)
tree378c39cf08d231c303fffa124644ea3300e1f46a /toke.c
parentb7e9a5c2d751f7ed3b8a703e57ac933ded5b16ce (diff)
downloadperl-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 'toke.c')
-rw-r--r--toke.c15
1 files changed, 11 insertions, 4 deletions
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:
+*/