summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-04 14:09:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:44:55 -0700
commit24b6ef70a86a5d0e357194d0de0d4698aa6f7197 (patch)
tree862c613b13fdf0a97c7726e42e4dbf70cccce93e /toke.c
parent4210d3f17cf9d854c0cbf0e1afb06e737174f8ea (diff)
downloadperl-24b6ef70a86a5d0e357194d0de0d4698aa6f7197.tar.gz
toke.c:yylex:KEY_sub can use PL_tokenbuf to begin with
There is no need to allocate a separate ‘tmpbuf’ and then copy it into PL_tokenbuf afterwards.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/toke.c b/toke.c
index 8f5475c59d..901ebe9f0a 100644
--- a/toke.c
+++ b/toke.c
@@ -8195,7 +8195,7 @@ Perl_yylex(pTHX)
case KEY_sub:
really_sub:
{
- char tmpbuf[sizeof PL_tokenbuf];
+ char * const tmpbuf = PL_tokenbuf + 1;
SSize_t tboffset = 0;
expectation attrful;
bool have_name, have_proto;
@@ -8226,7 +8226,8 @@ Perl_yylex(pTHX)
attrful = XATTRBLOCK;
/* remember buffer pos'n for later force_word */
tboffset = s - PL_oldbufptr;
- d = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len);
+ d = scan_word(s, tmpbuf, sizeof PL_tokenbuf - 1, TRUE,
+ &len);
#ifdef PERL_MAD
if (PL_madskills)
nametoke = newSVpvn_flags(s, d - s, SvUTF8(PL_linestr));
@@ -8243,8 +8244,6 @@ Perl_yylex(pTHX)
have_name = TRUE;
*PL_tokenbuf = '&';
- Copy(tmpbuf, PL_tokenbuf+1, len, char);
- PL_tokenbuf[len+1] = '\0';
#ifdef PERL_MAD
start_force(0);