diff options
author | TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> | 2022-10-04 23:58:33 +0900 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-10-13 10:27:43 -0600 |
commit | 1932805f63d6181a90fe36fabbdc3755a78b072f (patch) | |
tree | df191c9e36b88569fa1ad23a2f1444d4755c9a09 | |
parent | be5c21321156733f58ac73b090ea937da104f7fa (diff) | |
download | perl-1932805f63d6181a90fe36fabbdc3755a78b072f.tar.gz |
Use `LINE_Tf` thoroughly for formatting the value of CopLINE()
The value of CopLINE() used to be formatted with various way; sometimes
with `%ld` and `(long)` cast, sometimes `IVdf` and `(IV)` cast, or `%d`
and so on.
-rw-r--r-- | deb.c | 7 | ||||
-rw-r--r-- | dump.c | 4 | ||||
-rw-r--r-- | op.c | 14 | ||||
-rw-r--r-- | perlio.c | 6 | ||||
-rw-r--r-- | pp_ctl.c | 4 | ||||
-rw-r--r-- | toke.c | 6 | ||||
-rw-r--r-- | util.c | 6 |
7 files changed, 24 insertions, 23 deletions
@@ -87,17 +87,18 @@ Perl_vdeb(pTHX_ const char *pat, va_list *args) #ifdef DEBUGGING const char* const file = PL_curcop ? OutCopFILE(PL_curcop) : "<null>"; const char* const display_file = file ? file : "<free>"; - long line = PL_curcop ? (long)CopLINE(PL_curcop) : NOLINE; + line_t line = PL_curcop ? CopLINE(PL_curcop) : NOLINE; if (line == NOLINE) line = 0; PERL_ARGS_ASSERT_VDEB; if (DEBUG_v_TEST) - PerlIO_printf(Perl_debug_log, "(%ld:%s:%ld)\t", + PerlIO_printf(Perl_debug_log, "(%ld:%s:%" LINE_Tf ")\t", (long)PerlProc_getpid(), display_file, line); else - PerlIO_printf(Perl_debug_log, "(%s:%ld)\t", display_file, line); + PerlIO_printf(Perl_debug_log, "(%s:%" LINE_Tf ")\t", + display_file, line); (void) PerlIO_vprintf(Perl_debug_log, pat, *args); #else PERL_UNUSED_CONTEXT; @@ -1318,8 +1318,8 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o) case OP_NEXTSTATE: case OP_DBSTATE: if (CopLINE(cCOPo)) - S_opdump_indent(aTHX_ o, level, bar, file, "LINE = %" UVuf "\n", - (UV)CopLINE(cCOPo)); + S_opdump_indent(aTHX_ o, level, bar, file, "LINE = %" LINE_Tf "\n", + CopLINE(cCOPo)); if (CopSTASHPV(cCOPo)) { SV* tmpsv = newSVpvs_flags("", SVs_TEMP); @@ -10048,10 +10048,10 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) GV * const db_postponed = gv_fetchpvs("DB::postponed", GV_ADDMULTI, SVt_PVHV); HV *hv; - SV * const sv = Perl_newSVpvf(aTHX_ "%s:%ld-%ld", + SV * const sv = Perl_newSVpvf(aTHX_ "%s:%ld-%" LINE_Tf, CopFILE(PL_curcop), (long)PL_subline, - (long)CopLINE(PL_curcop)); + CopLINE(PL_curcop)); if (HvNAME_HEK(PL_curstash)) { sv_sethek(tmpstr, HvNAME_HEK(PL_curstash)); sv_catpvs(tmpstr, "::"); @@ -10260,9 +10260,9 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, has_name = TRUE; } else if (PERLDB_NAMEANON && CopLINE(PL_curcop)) { SV * const sv = sv_newmortal(); - Perl_sv_setpvf(aTHX_ sv, "%s[%s:%" IVdf "]", + Perl_sv_setpvf(aTHX_ sv, "%s[%s:%" LINE_Tf "]", PL_curstash ? "__ANON__" : "__ANON__::__ANON__", - CopFILE(PL_curcop), (IV)CopLINE(PL_curcop)); + CopFILE(PL_curcop), CopLINE(PL_curcop)); gv = gv_fetchsv(sv, gv_fetch_flags, SVt_PVCV); has_name = TRUE; } else if (PL_curstash) { @@ -10656,10 +10656,10 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, GV * const db_postponed = gv_fetchpvs("DB::postponed", GV_ADDMULTI, SVt_PVHV); HV *hv; - SV * const sv = Perl_newSVpvf(aTHX_ "%s:%ld-%ld", + SV * const sv = Perl_newSVpvf(aTHX_ "%s:%ld-%" LINE_Tf, CopFILE(PL_curcop), (long)PL_subline, - (long)CopLINE(PL_curcop)); + CopLINE(PL_curcop)); (void)hv_store_ent(GvHV(PL_DBsub), tmpstr, sv, 0); hv = GvHVn(db_postponed); if (HvTOTALKEYS(hv) > 0 && hv_exists_ent(hv, tmpstr, 0)) { @@ -13973,7 +13973,7 @@ Perl_ck_entersub_args_core(pTHX_ OP *entersubop, GV *namegv, SV *protosv) case 'L': return newSVOP( OP_CONST, 0, Perl_newSVpvf(aTHX_ - "%" IVdf, (IV)CopLINE(PL_curcop) + "%" LINE_Tf, CopLINE(PL_curcop) ) ); case 'P': return newSVOP(OP_CONST, 0, @@ -362,7 +362,7 @@ PerlIO_debug(const char *fmt, ...) const char * const s = CopFILE(PL_curcop); /* Use fixed buffer as sv_catpvf etc. needs SVs */ char buffer[1024]; - const STRLEN len1 = my_snprintf(buffer, sizeof(buffer), "%.40s:%" IVdf " ", s ? s : "(none)", (IV) CopLINE(PL_curcop)); + const STRLEN len1 = my_snprintf(buffer, sizeof(buffer), "%.40s:%" LINE_Tf " ", s ? s : "(none)", CopLINE(PL_curcop)); # ifdef USE_QUADMATH # ifdef HAS_VSNPRINTF /* my_vsnprintf() isn't available with quadmath, but the native vsnprintf() @@ -380,8 +380,8 @@ PerlIO_debug(const char *fmt, ...) #else const char *s = CopFILE(PL_curcop); STRLEN len; - SV * const sv = Perl_newSVpvf(aTHX_ "%s:%" IVdf " ", s ? s : "(none)", - (IV) CopLINE(PL_curcop)); + SV * const sv = Perl_newSVpvf(aTHX_ "%s:%" LINE_Tf " ", + s ? s : "(none)", CopLINE(PL_curcop)); Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap); s = SvPV_const(sv, len); @@ -4693,9 +4693,9 @@ PP(pp_entereval) if (PERLDB_NAMEEVAL && CopLINE(PL_curcop)) { SV * const temp_sv = sv_newmortal(); - Perl_sv_setpvf(aTHX_ temp_sv, "_<(eval %lu)[%s:%" IVdf "]", + Perl_sv_setpvf(aTHX_ temp_sv, "_<(eval %lu)[%s:%" LINE_Tf "]", (unsigned long)++PL_evalseq, - CopFILE(PL_curcop), (IV)CopLINE(PL_curcop)); + CopFILE(PL_curcop), CopLINE(PL_curcop)); tmpbuf = SvPVX(temp_sv); len = SvCUR(temp_sv); } @@ -7755,7 +7755,7 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct case KEY___LINE__: FUN0OP( newSVOP(OP_CONST, 0, - Perl_newSVpvf(aTHX_ "%" IVdf, (IV)CopLINE(PL_curcop))) + Perl_newSVpvf(aTHX_ "%" LINE_Tf, CopLINE(PL_curcop))) ); case KEY___PACKAGE__: @@ -12626,9 +12626,9 @@ Perl_yyerror_pvn(pTHX_ const char *const s, STRLEN len, U32 flags) Perl_sv_catpvf(aTHX_ where_sv, "\\%03o", yychar & 255); } msg = newSVpvn_flags(s, len, (flags & SVf_UTF8) | SVs_TEMP); - Perl_sv_catpvf(aTHX_ msg, " at %s line %" IVdf ", ", + Perl_sv_catpvf(aTHX_ msg, " at %s line %" LINE_Tf ", ", OutCopFILE(PL_curcop), - (IV)(PL_parser->preambling == NOLINE + (PL_parser->preambling == NOLINE ? CopLINE(PL_curcop) : PL_parser->preambling)); if (context) @@ -1742,8 +1742,8 @@ Perl_mess_sv(pTHX_ SV *basemsg, bool consume) cop = PL_curcop; if (CopLINE(cop)) - Perl_sv_catpvf(aTHX_ sv, " at %s line %" IVdf, - OutCopFILE(cop), (IV)CopLINE(cop)); + Perl_sv_catpvf(aTHX_ sv, " at %s line %" LINE_Tf, + OutCopFILE(cop), CopLINE(cop)); } /* Seems that GvIO() can be untrustworthy during global destruction. */ @@ -5233,7 +5233,7 @@ S_mem_log_common(enum mem_log_type mlt, const UV n, #ifdef USE_C_BACKTRACE if(strchr(pmlenv,'c') && (mlt == MLT_NEW_SV)) { len = my_snprintf(buf, sizeof(buf), - " caller %s at %s line %d\n", + " caller %s at %s line %" LINE_Tf "\n", /* CopSTASHPV can crash early on startup; use CopFILE to check */ CopFILE(PL_curcop) ? CopSTASHPV(PL_curcop) : "<unknown>", CopFILE(PL_curcop), CopLINE(PL_curcop)); |