Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 2ddbc74

Browse files
committed
fix %s SvPVX_const(cv_name
to %SVf SVfARG(cv_name, which does handle empty names, i.e. does not fail on strlen(NULL).
1 parent 6f56a45 commit 2ddbc74

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

op.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11415,8 +11415,8 @@ S_op_const_sv(pTHX_ const OP *o, CV *cv, bool allow_lex)
1141511415
CvCONST_on(cv);
1141611416
return NULL;
1141711417
}
11418-
DEBUG_k(Perl_deb(aTHX_ "op_const_sv: inlined SV 0x%p %s\n",
11419-
sv, SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN))));
11418+
DEBUG_k(Perl_deb(aTHX_ "op_const_sv: inlined SV 0x%p %" SVf "\n",
11419+
sv, SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN))));
1142011420
#ifdef DEBUGGING
1142111421
if (sv) {
1142211422
DEBUG_kv(Perl_sv_dump(aTHX_ sv));

pp_ctl.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,8 +2943,8 @@ PP(pp_goto)
29432943
#endif
29442944
padlist = CvPADLIST(cv);
29452945
DEBUG_k(PerlIO_printf(Perl_debug_log,
2946-
"goto %s from sig with sig: keep %ld args\n",
2947-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN)),
2946+
"goto %" SVf " from sig with sig: keep %ld args\n",
2947+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN)),
29482948
(long)argc));
29492949
padp = &PL_curpad[1]; /* from old pad. 0 has @_ */
29502950
for (; stack <= cx->blk_sub.argarray; ) {
@@ -2960,16 +2960,16 @@ PP(pp_goto)
29602960
CX_LEAVE_SCOPE(cx);
29612961
PAD_SET_CUR(padlist, PadlistMAX(padlist));
29622962
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
2963-
"Pad padlist max=%d, CvDEPTH=%d (goto sig2sig %s)\n",
2963+
"Pad padlist max=%d, CvDEPTH=%d (goto sig2sig %" SVf ")\n",
29642964
(int)PadlistMAX(padlist), (int)CvDEPTH(cv),
2965-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN))));
2965+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN))));
29662966
goto call_pp_sub;
29672967
}
29682968
/* pp2sig: */
29692969
SvREFCNT_inc_simple_void(cv); /* dec below */
29702970
DEBUG_k(PerlIO_printf(Perl_debug_log,
2971-
"goto %s with sig: keep %ld args\n",
2972-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN)),
2971+
"goto %" SVf " with sig: keep %ld args\n",
2972+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN)),
29732973
(long)AvFILLp(arg)+1)); /* sig arg has no fill */
29742974
CX_LEAVE_SCOPE(cx);
29752975
}
@@ -2999,8 +2999,8 @@ PP(pp_goto)
29992999
}
30003000
}
30013001
DEBUG_k(PerlIO_printf(Perl_debug_log,
3002-
"goto sig2pp %s: copy %ld args\n",
3003-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN)),
3002+
"goto sig2pp %" SVf ": copy %ld args\n",
3003+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN)),
30043004
(long)argc));
30053005
/* Note that this can still leave AvARRAY(@_) at 0x0.
30063006
With args this is alloced at av_store. */
@@ -3017,8 +3017,8 @@ PP(pp_goto)
30173017
if (!arg || (av == arg) || AvREAL(av))
30183018
clear_defarray(av, arg && (av == arg));
30193019
DEBUG_k(PerlIO_printf(Perl_debug_log,
3020-
"goto pp %s: keep %ld args\n",
3021-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN)),
3020+
"goto pp %" SVf ": keep %ld args\n",
3021+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN)),
30223022
arg ? (long)AvFILLp(arg)+1 : 0));
30233023
}
30243024
}
@@ -3048,9 +3048,9 @@ PP(pp_goto)
30483048

30493049
if (CxTYPE(cx) == CXt_SUB) {
30503050
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
3051-
"Pad CvDEPTH %d => %d (%s)\n",
3051+
"Pad CvDEPTH %d => %d (%" SVf ")\n",
30523052
(int)CvDEPTH(cx->blk_sub.cv), (int) cx->blk_sub.olddepth,
3053-
SvPVX_const(cv_name(cx->blk_sub.cv, NULL, CV_NAME_NOMAIN))));
3053+
SVfARG(cv_name(cx->blk_sub.cv, NULL, CV_NAME_NOMAIN))));
30543054
CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth;
30553055
SvREFCNT_dec_NN(cx->blk_sub.cv);
30563056
}
@@ -3116,9 +3116,9 @@ PP(pp_goto)
31163116
/* dist/Test-Simple/t/capture.t? */
31173117
depth = PadlistMAX(padlist);
31183118
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
3119-
"Pad padlist max=%d, CvDEPTH=%d (tailcall %s)\n",
3119+
"Pad padlist max=%d, CvDEPTH=%d (tailcall %" SVf ")\n",
31203120
(int)depth, (int)CvDEPTH(cv),
3121-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN))));
3121+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN))));
31223122
if (CvDEPTH(cv) <= depth)
31233123
CvDEPTH(cv) = depth;
31243124
#endif
@@ -3162,9 +3162,9 @@ PP(pp_goto)
31623162
if (CvDEPTH(cv) == PERL_SUB_DEPTH_WARN && ckWARN(WARN_RECURSION))
31633163
sub_crush_depth(cv);
31643164
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
3165-
"Pad push padlist max=%d, CvDEPTH=%d (goto %s)\n",
3165+
"Pad push padlist max=%d, CvDEPTH=%d (goto %" SVf ")\n",
31663166
(int)PadlistMAX(padlist), (int)CvDEPTH(cv),
3167-
SvPVX_const(cv_name(cv, NULL, CV_NAME_NOMAIN))));
3167+
SVfARG(cv_name(cv, NULL, CV_NAME_NOMAIN))));
31683168
pad_push(padlist, CvDEPTH(cv));
31693169
}
31703170
PL_curcop = cx->blk_oldcop;

pp_hot.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5806,34 +5806,34 @@ PP(pp_signature)
58065806
po = (++items)->uv >> OPpPADRANGE_COUNTSHIFT;
58075807
pn = padnl[po];
58085808
/* diag_listed_as: Not enough arguments for %s */
5809-
S_croak_caller("Not enough arguments for %s%s%s %s. Want: %"UVuf
5809+
S_croak_caller("Not enough arguments for %s%s%s %" SVf ". Want: %"UVuf
58105810
", but got: %"UVuf". Missing %s",
58115811
CvDESC3(cv),
5812-
SvPVX_const(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
5812+
SVfARG(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
58135813
mand_params, argc, PadnamePV(pn));
58145814
} else
58155815
#endif
58165816
/* diag_listed_as: Not enough arguments for %s */
5817-
S_croak_caller("Not enough arguments for %s%s%s %s. Want: %" UVuf
5817+
S_croak_caller("Not enough arguments for %s%s%s %" SVf ". Want: %" UVuf
58185818
", but got: %" UVuf,
58195819
CvDESC3(cv),
5820-
SvPVX_const(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
5820+
SVfARG(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
58215821
mand_params, argc);
58225822
}
58235823
if (UNLIKELY(!slurpy && argc > mand_params + opt_params)) {
58245824
if (opt_params)
58255825
/* diag_listed_as: Too many arguments for %s */
5826-
S_croak_caller("Too many arguments for %s%s%s %s. Want: %" UVuf
5826+
S_croak_caller("Too many arguments for %s%s%s %" SVf ". Want: %" UVuf
58275827
"-%" UVuf ", but got: %" UVuf,
58285828
CvDESC3(cv),
5829-
SvPVX_const(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
5829+
SVfARG(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
58305830
mand_params, mand_params + opt_params, argc);
58315831
else
58325832
/* diag_listed_as: Too many arguments for %s */
5833-
S_croak_caller("Too many arguments for %s%s%s %s. Want: %" UVuf
5833+
S_croak_caller("Too many arguments for %s%s%s %" SVf ". Want: %" UVuf
58345834
", but got: %" UVuf,
58355835
CvDESC3(cv),
5836-
SvPVX_const(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
5836+
SVfARG(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)),
58375837
mand_params, argc);
58385838
}
58395839

@@ -6183,8 +6183,8 @@ PP(pp_signature)
61836183
PERL_CONTEXT *cx = &cxstack[cxstack_ix];
61846184
const CV *cv = cx->blk_sub.cv;
61856185
/* diag_listed_as: Odd name/value argument for subroutine */
6186-
S_croak_caller("Odd name/value argument for %s%s%s %s", CvDESC3(cv),
6187-
SvPVX_const(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)));
6186+
S_croak_caller("Odd name/value argument for %s%s%s %" SVf, CvDESC3(cv),
6187+
SVfARG(cv_name((CV*)cv,NULL,CV_NAME_NOMAIN)));
61886188
}
61896189
/* warn */
61906190
do_oddball(argp + argc -1, argp);

xsutils.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -896,26 +896,26 @@ Perl_prep_ffi_sig(pTHX_ CV* cv, const unsigned int num_args, SV** argp, void **a
896896

897897
if (UNLIKELY(num_args < mand_params)) {
898898
/* diag_listed_as: Not enough arguments for %s */
899-
Perl_croak(aTHX_ "Not enough arguments for %s%s%s %s. Want: %" UVuf
899+
Perl_croak(aTHX_ "Not enough arguments for %s%s%s %" SVf ". Want: %" UVuf
900900
", but got: %u",
901901
CvDESC3(cv),
902-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
902+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
903903
mand_params, num_args);
904904
}
905905
if (UNLIKELY(!slurpy && num_args > mand_params + opt_params)) {
906906
if (opt_params)
907907
/* diag_listed_as: Too many arguments for %s */
908-
Perl_croak(aTHX_ "Too many arguments for %s%s%s %s. Want: %" UVuf "-%" UVuf
908+
Perl_croak(aTHX_ "Too many arguments for %s%s%s %" SVf ". Want: %" UVuf "-%" UVuf
909909
", but got: %u",
910910
CvDESC3(cv),
911-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
911+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
912912
mand_params, mand_params + opt_params, num_args);
913913
else
914914
/* diag_listed_as: Too many arguments for %s */
915-
Perl_croak(aTHX_ "Too many arguments for %s%s%s %s. Want: %" UVuf
915+
Perl_croak(aTHX_ "Too many arguments for %s%s%s %" SVf ". Want: %" UVuf
916916
", but got: %u",
917917
CvDESC3(cv),
918-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
918+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
919919
mand_params, num_args);
920920
}
921921
/* For an empty signature, our only task was to check that the caller
@@ -947,9 +947,9 @@ Perl_prep_ffi_sig(pTHX_ CV* cv, const unsigned int num_args, SV** argp, void **a
947947
argtype = S_prep_sig(aTHX_ HvNAME(type), HvNAMELEN(type));
948948
#endif
949949
} else {
950-
Perl_croak(aTHX_ "Type of arg %s to %s must be %s (not %s)",
950+
Perl_croak(aTHX_ "Type of arg %s to %" SVf " must be %s (not %s)",
951951
argname ? PadnamePV(argname) : "",
952-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
952+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
953953
"declared", "empty");
954954
}
955955
#if defined(USE_FFI) && !defined(PERL_IS_MINIPERL)
@@ -958,9 +958,9 @@ Perl_prep_ffi_sig(pTHX_ CV* cv, const unsigned int num_args, SV** argp, void **a
958958
if (argtype == &ffi_type_pointer)
959959
*argvalues++ = &SvPVX(*argp++);
960960
else
961-
Perl_croak(aTHX_ "Type of arg %s to %s must be %s (not %s)",
961+
Perl_croak(aTHX_ "Type of arg %s to %" SVf " must be %s (not %s)",
962962
PadnamePV(argname),
963-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
963+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
964964
"of ptr", HvNAME(type));
965965
}
966966
else if (SvIOK(*argp)) {
@@ -970,23 +970,23 @@ Perl_prep_ffi_sig(pTHX_ CV* cv, const unsigned int num_args, SV** argp, void **a
970970
else
971971
*argvalues++ = &SvIVX(*argp++);
972972
} else
973-
Perl_croak(aTHX_ "Type of arg %s to %s must be %s (not %s)",
973+
Perl_croak(aTHX_ "Type of arg %s to %" SVf " must be %s (not %s)",
974974
PadnamePV(argname),
975-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
975+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
976976
"of int", HvNAME(type));
977977
}
978978
else if (SvNOK(*argp)) {
979979
if (argtype != &ffi_type_pointer)
980980
*argvalues++ = &SvNVX(*argp++);
981981
else
982-
Perl_croak(aTHX_ "Type of arg %s to %s must be %s (not %s)",
982+
Perl_croak(aTHX_ "Type of arg %s to %" SVf " must be %s (not %s)",
983983
PadnamePV(argname),
984-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
984+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
985985
"of num", HvNAME(type));
986986
} else {
987-
Perl_croak(aTHX_ "Type of arg %s to %s must be %s (not %s)",
987+
Perl_croak(aTHX_ "Type of arg %s to %" SVf " must be %s (not %s)",
988988
PadnamePV(argname),
989-
SvPVX_const(cv_name(cv,NULL,CV_NAME_NOMAIN)),
989+
SVfARG(cv_name(cv,NULL,CV_NAME_NOMAIN)),
990990
"valid", HvNAME(type));
991991
}
992992
#else

0 commit comments

Comments
 (0)