summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-18 18:59:59 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-18 18:59:59 +0000
commit5ab7ff9835a1d1b96af849579ce604bb74101206 (patch)
tree29c1119e0f8393dad9eccbde956162ca051469d4 /toke.c
parent120f7abe0541f57e1b9cad739dd69b63bb352093 (diff)
downloadperl-5ab7ff9835a1d1b96af849579ce604bb74101206.tar.gz
Inline and eliminate S_incl_perldb(), as it's only called on one place.
This also makes the logic in the call site simpler and more efficient. p4raw-id: //depot/perl@32138
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/toke.c b/toke.c
index 848739702b..7587df1860 100644
--- a/toke.c
+++ b/toke.c
@@ -2758,29 +2758,6 @@ S_intuit_method(pTHX_ char *start, GV *gv, CV *cv)
return 0;
}
-/*
- * S_incl_perldb
- * Return a string of Perl code to load the debugger. If PERL5DB
- * is set, it will return the contents of that, otherwise a
- * compile-time require of perl5db.pl.
- */
-
-STATIC const char*
-S_incl_perldb(pTHX)
-{
- dVAR;
- if (PL_perldb) {
- const char * const pdb = PerlEnv_getenv("PERL5DB");
-
- if (pdb)
- return pdb;
- SETERRNO(0,SS_NORMAL);
- return "BEGIN { require 'perl5db.pl' }";
- }
- return "";
-}
-
-
/* Encoded script support. filter_add() effectively inserts a
* 'pre-processing' function into the current source input stream.
* Note that the filter function only applies to the current source file
@@ -3618,9 +3595,22 @@ Perl_yylex(pTHX)
if (PL_madskills)
PL_faketokens = 1;
#endif
- sv_setpv(PL_linestr,incl_perldb());
- if (SvCUR(PL_linestr))
- sv_catpvs(PL_linestr,";");
+ if (PL_perldb) {
+ /* Generate a string of Perl code to load the debugger.
+ * If PERL5DB is set, it will return the contents of that,
+ * otherwise a compile-time require of perl5db.pl. */
+
+ const char * const pdb = PerlEnv_getenv("PERL5DB");
+
+ if (pdb) {
+ sv_setpv(PL_linestr, pdb);
+ sv_catpvs(PL_linestr,";");
+ } else {
+ SETERRNO(0,SS_NORMAL);
+ sv_setpvs(PL_linestr, "BEGIN { require 'perl5db.pl' };");
+ }
+ } else
+ sv_setpvs(PL_linestr,"");
if (PL_preambleav){
while(AvFILLp(PL_preambleav) >= 0) {
SV *tmpsv = av_shift(PL_preambleav);