diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-01-09 19:42:30 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-01-09 19:42:30 +0000 |
commit | 8a7a129d01690124356e6e97ab81becf500e68af (patch) | |
tree | 85949e7cca5a6dcd93441d772a4ec8b6c0c9e67b /toke.c | |
parent | d0a148a65266eeca56c2cf89da692556239ed991 (diff) | |
download | perl-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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. */ |