From: Nicholas Clark Date: Thu, 18 Oct 2007 18:59:59 +0000 (+0000) Subject: Inline and eliminate S_incl_perldb(), as it's only called on one place. X-Git-Tag: accepted/trunk/20130322.191538~14352 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ab7ff9835a1d1b96af849579ce604bb74101206;p=platform%2Fupstream%2Fperl.git 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 --- diff --git a/embed.fnc b/embed.fnc index 2f0c2c8..89fa7ea 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1555,7 +1555,6 @@ so |SV* |new_constant |NULLOK const char *s|STRLEN len \ |NULLOK SV *pv|NULLOK const char *type \ |STRLEN typelen s |int |ao |int toketype -s |const char*|incl_perldb # if defined(PERL_CR_FILTER) s |I32 |cr_textfilter |int idx|NULLOK SV *sv|int maxlen s |void |strip_return |NN SV *sv diff --git a/embed.h b/embed.h index a0fcb93..57f6185 100644 --- a/embed.h +++ b/embed.h @@ -1536,7 +1536,6 @@ #endif #ifdef PERL_CORE #define ao S_ao -#define incl_perldb S_incl_perldb #endif # if defined(PERL_CR_FILTER) #ifdef PERL_CORE @@ -3823,7 +3822,6 @@ #define find_in_my_stash(a,b) S_find_in_my_stash(aTHX_ a,b) #define tokenize_use(a,b) S_tokenize_use(aTHX_ a,b) #define ao(a) S_ao(aTHX_ a) -#define incl_perldb() S_incl_perldb(aTHX) #endif # if defined(PERL_CR_FILTER) #ifdef PERL_CORE diff --git a/proto.h b/proto.h index 8d515af..7adaac7 100644 --- a/proto.h +++ b/proto.h @@ -4133,7 +4133,6 @@ STATIC SV* S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRL __attribute__nonnull__(pTHX_5); STATIC int S_ao(pTHX_ int toketype); -STATIC const char* S_incl_perldb(pTHX); # if defined(PERL_CR_FILTER) STATIC I32 S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen); STATIC void S_strip_return(pTHX_ SV *sv) diff --git a/toke.c b/toke.c index 8487397..7587df1 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);