summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-09-17 19:21:24 +0000
committerNicholas Clark <nick@ccl4.org>2005-09-17 19:21:24 +0000
commitea5389caff9d08b0325fec397a2c98a8e11e0dc1 (patch)
tree00317d33da98d2f97a2d56d1bffdd086049663f0 /toke.c
parent206b424e820e2f3d021bbf46c1334b08369488ee (diff)
downloadperl-ea5389caff9d08b0325fec397a2c98a8e11e0dc1.tar.gz
Integrate:
[ 24243] A more efficient way of expressing the MALLOC_WRAP conditional compile. [ 24244] Replace Renew(SvPVX(...)...) with SvPV_renew, which avoids an LVALUE SvPVX [ 24245] 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-link: @24245 on //depot/perl: 1da4ca5ff65374ad6965719e5eb33e3027a745a7 p4raw-link: @24244 on //depot/perl: b7e9a5c2d751f7ed3b8a703e57ac933ded5b16ce p4raw-link: @24243 on //depot/perl: 8b44ba4cc571a1253e8c2108fde4508f22646523 p4raw-id: //depot/maint-5.8/perl@25449 p4raw-integrated: from //depot/perl@24245 'edit in' pp_hot.c sv.h (@24244..) p4raw-integrated: from //depot/perl@24244 'edit in' pp_sys.c (@24223..) toke.c (@24233..) p4raw-integrated: from //depot/perl@24243 'copy in' handy.h (@24217..)
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/toke.c b/toke.c
index 82d9724331..ee8ca879f6 100644
--- a/toke.c
+++ b/toke.c
@@ -1820,8 +1820,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);
- Renew(SvPVX(sv), SvLEN(sv), char);
+ SvPV_shrink_to_cur(sv);
}
/* return the substring (via yylval) only if we parsed anything */
@@ -9555,8 +9554,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);
- Renew(SvPVX(tmpstr), SvLEN(tmpstr), char);
+ SvPV_shrink_to_cur(tmpstr);
}
SvREFCNT_dec(herewas);
if (!IN_BYTES) {
@@ -10032,7 +10030,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims)
/* if we allocated too much space, give some back */
if (SvCUR(sv) + 5 < SvLEN(sv)) {
SvLEN_set(sv, SvCUR(sv) + 1);
- Renew(SvPVX(sv), SvLEN(sv), char);
+ SvPV_renew(sv, SvLEN(sv));
}
/* decide whether this is the first or second quoted string we've read
@@ -10940,3 +10938,12 @@ Perl_scan_vstring(pTHX_ 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:
+*/