summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-01-09 19:42:30 +0000
committerNicholas Clark <nick@ccl4.org>2005-01-09 19:42:30 +0000
commit8a7a129d01690124356e6e97ab81becf500e68af (patch)
tree85949e7cca5a6dcd93441d772a4ec8b6c0c9e67b /toke.c
parentd0a148a65266eeca56c2cf89da692556239ed991 (diff)
downloadperl-8a7a129d01690124356e6e97ab81becf500e68af.tar.gz
Can pass in a length here without introducing a bug. Might save
a strlen() p4raw-id: //depot/perl@23771
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 1fd70174e5..fcd143a98a 100644
--- a/toke.c
+++ b/toke.c
@@ -4144,8 +4144,12 @@ Perl_yylex(pTHX)
sv = newSVpvn("CORE::GLOBAL::",14);
sv_catpv(sv,PL_tokenbuf);
}
- else
- sv = newSVpv(PL_tokenbuf,0);
+ else {
+ /* If len is 0, newSVpv does strlen(), which is correct.
+ If len is non-zero, then it will be the true length,
+ and so the scalar will be created correctly. */
+ sv = newSVpv(PL_tokenbuf,len);
+ }
/* Presume this is going to be a bareword of some sort. */