diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-18 18:06:29 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-18 18:06:29 +0000 |
commit | 49a54bbe5e246f5f51e51453d9cc5a19e72a4433 (patch) | |
tree | 95c13d0218c4813cdf5947b181e8bdfe96f76e4b /toke.c | |
parent | 9ff8e8065ea8557fda504cf7c2337bef185cd00f (diff) | |
download | perl-49a54bbe5e246f5f51e51453d9cc5a19e72a4433.tar.gz |
Eliminate some uses of sv_setpv() where we already know the length.
Donate the prototype buffer to the CV in Perl_gv_init(), rather than
setting a copy, and immediately free()ing the original.
p4raw-id: //depot/perl@32136
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -3694,10 +3694,10 @@ Perl_yylex(pTHX) if (PL_madskills) PL_faketokens = 1; #endif - sv_setpv(PL_linestr, - (const char *) - (PL_minus_p - ? ";}continue{print;}" : ";}")); + if (PL_minus_p) + sv_setpvs(PL_linestr, ";}continue{print;}"); + else + sv_setpvs(PL_linestr, ";}"); PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = NULL; @@ -5534,10 +5534,10 @@ Perl_yylex(pTHX) while (*proto == ';') proto++; if (*proto == '&' && *s == '{') { - sv_setpv(PL_subname, - (const char *) - (PL_curstash ? - "__ANON__" : "__ANON__::__ANON__")); + if (PL_curstash) + sv_setpvs(PL_subname, "__ANON__"); + else + sv_setpvs(PL_subname, "__ANON__::__ANON__"); PREBLOCK(LSTOPSUB); } } @@ -6758,9 +6758,10 @@ Perl_yylex(pTHX) } #endif if (!have_name) { - sv_setpv(PL_subname, - (const char *) - (PL_curstash ? "__ANON__" : "__ANON__::__ANON__")); + if (PL_curstash) + sv_setpvs(PL_subname, "__ANON__"); + else + sv_setpvs(PL_subname, "__ANON__::__ANON__"); TOKEN(ANONSUB); } #ifndef PERL_MAD |