From: Nicholas Clark Date: Thu, 11 Jan 2007 00:24:48 +0000 (+0000) Subject: In toke.c, merge S_update_debugger_info_pv() and X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5fa550fb3553a576bba2951a8073ed615edabf77;p=p5sagit%2Fp5-mst-13.2.git In toke.c, merge S_update_debugger_info_pv() and S_update_debugger_info_sv() into S_update_debugger_info(). p4raw-id: //depot/perl@29749 --- diff --git a/embed.fnc b/embed.fnc index 963d80f..1248f25 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1476,8 +1476,8 @@ sR |char* |scan_subst |NN char *start sR |char* |scan_trans |NN char *start s |char* |scan_word |NN char *s|NN char *dest|STRLEN destlen \ |int allow_package|NN STRLEN *slp -s |void |update_debugger_info_pv|NN const char *buf|STRLEN len -s |void |update_debugger_info_sv|NN SV *orig_sv +s |void |update_debugger_info|NULLOK SV *orig_sv \ + |NULLOK const char *buf|STRLEN len sR |char* |skipspace |NN char *s sR |char* |swallow_bom |NN U8 *s s |void |checkcomma |NN const char *s|NN const char *name \ diff --git a/embed.h b/embed.h index 40d24c5..481edfa 100644 --- a/embed.h +++ b/embed.h @@ -1470,8 +1470,7 @@ #define scan_subst S_scan_subst #define scan_trans S_scan_trans #define scan_word S_scan_word -#define update_debugger_info_pv S_update_debugger_info_pv -#define update_debugger_info_sv S_update_debugger_info_sv +#define update_debugger_info S_update_debugger_info #define skipspace S_skipspace #define swallow_bom S_swallow_bom #define checkcomma S_checkcomma @@ -3678,8 +3677,7 @@ #define scan_subst(a) S_scan_subst(aTHX_ a) #define scan_trans(a) S_scan_trans(aTHX_ a) #define scan_word(a,b,c,d,e) S_scan_word(aTHX_ a,b,c,d,e) -#define update_debugger_info_pv(a,b) S_update_debugger_info_pv(aTHX_ a,b) -#define update_debugger_info_sv(a) S_update_debugger_info_sv(aTHX_ a) +#define update_debugger_info(a,b,c) S_update_debugger_info(aTHX_ a,b,c) #define skipspace(a) S_skipspace(aTHX_ a) #define swallow_bom(a) S_swallow_bom(aTHX_ a) #define checkcomma(a,b,c) S_checkcomma(aTHX_ a,b,c) diff --git a/proto.h b/proto.h index c82f94b..8b0f8e7 100644 --- a/proto.h +++ b/proto.h @@ -3971,12 +3971,7 @@ STATIC char* S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_pa __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_5); -STATIC void S_update_debugger_info_pv(pTHX_ const char *buf, STRLEN len) - __attribute__nonnull__(pTHX_1); - -STATIC void S_update_debugger_info_sv(pTHX_ SV *orig_sv) - __attribute__nonnull__(pTHX_1); - +STATIC void S_update_debugger_info(pTHX_ SV *orig_sv, const char *buf, STRLEN len); STATIC char* S_skipspace(pTHX_ char *s) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); diff --git a/toke.c b/toke.c index 87c26be..4d5d9c2 100644 --- a/toke.c +++ b/toke.c @@ -906,27 +906,16 @@ S_skipspace2(pTHX_ register char *s, SV **svp) #endif STATIC void -S_update_debugger_info_pv(pTHX_ const char *buf, STRLEN len) +S_update_debugger_info(pTHX_ SV *orig_sv, const char *buf, STRLEN len) { AV *av = CopFILEAVx(PL_curcop); if (av) { SV * const sv = newSV(0); sv_upgrade(sv, SVt_PVMG); - sv_setpvn(sv, buf, len); - (void)SvIOK_on(sv); - SvIV_set(sv, 0); - av_store(av, (I32)CopLINE(PL_curcop), sv); - } -} - -STATIC void -S_update_debugger_info_sv(pTHX_ SV *orig_sv) -{ - AV *av = CopFILEAVx(PL_curcop); - if (av) { - SV * const sv = newSV(0); - sv_upgrade(sv, SVt_PVMG); - sv_setsv(sv, orig_sv); + if (orig_sv) + sv_setsv(sv, orig_sv); + else + sv_setpvn(sv, buf, len); (void)SvIOK_on(sv); SvIV_set(sv, 0); av_store(av, (I32)CopLINE(PL_curcop), sv); @@ -1097,7 +1086,7 @@ S_skipspace(pTHX_ register char *s) * so store the line into the debugger's array of lines */ if (PERLDB_LINE && PL_curstash != PL_debstash) - update_debugger_info_pv(PL_bufptr, PL_bufend - PL_bufptr); + update_debugger_info(NULL, PL_bufptr, PL_bufend - PL_bufptr); } #ifdef PERL_MAD @@ -3604,7 +3593,7 @@ Perl_yylex(pTHX) PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = NULL; if (PERLDB_LINE && PL_curstash != PL_debstash) - update_debugger_info_sv(PL_linestr); + update_debugger_info(PL_linestr, NULL, 0); goto retry; } do { @@ -3697,7 +3686,7 @@ Perl_yylex(pTHX) } while (PL_doextract); PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = s; if (PERLDB_LINE && PL_curstash != PL_debstash) - update_debugger_info_sv(PL_linestr); + update_debugger_info(PL_linestr, NULL, 0); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = NULL; if (CopLINE(PL_curcop) == 1) { @@ -11260,7 +11249,7 @@ S_scan_heredoc(pTHX_ register char *s) PL_bufend[-1] = '\n'; #endif if (PERLDB_LINE && PL_curstash != PL_debstash) - update_debugger_info_sv(PL_linestr); + update_debugger_info(PL_linestr, NULL, 0); if (*s == term && memEQ(s,PL_tokenbuf,len)) { STRLEN off = PL_bufend - 1 - SvPVX_const(PL_linestr); *(SvPVX(PL_linestr) + off ) = ' '; @@ -11757,7 +11746,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims) /* update debugger info */ if (PERLDB_LINE && PL_curstash != PL_debstash) - update_debugger_info_sv(PL_linestr); + update_debugger_info(PL_linestr, NULL, 0); /* having changed the buffer, we must update PL_bufend */ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);