From: Nicholas Clark Date: Sun, 9 Jan 2005 19:42:30 +0000 (+0000) Subject: Can pass in a length here without introducing a bug. Might save X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a7a129d01690124356e6e97ab81becf500e68af;p=p5sagit%2Fp5-mst-13.2.git Can pass in a length here without introducing a bug. Might save a strlen() p4raw-id: //depot/perl@23771 --- diff --git a/toke.c b/toke.c index 1fd7017..fcd143a 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. */