Skip to content

Commit 153ebd6

Browse files
Leontmauke
authored andcommitted
Stop calling Perl_form manually
Call form() instead.
1 parent b7e4f70 commit 153ebd6

File tree

10 files changed

+91
-92
lines changed

10 files changed

+91
-92
lines changed

dquote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Perl_grok_bslash_c(pTHX_ const char source,
4646
const char control = toCTRL('{');
4747
if (isPRINT_A(control)) {
4848
/* diag_listed_as: Use "%s" instead of "%s" */
49-
*message = Perl_form(aTHX_ PERL_DIAG_DIE_SYNTAX("Use \"%c\" instead of \"\\c{\""), control);
49+
*message = form(PERL_DIAG_DIE_SYNTAX("Use \"%c\" instead of \"\\c{\""), control);
5050
}
5151
else {
5252
*message = "Sequence \"\\c{\" invalid";
@@ -67,7 +67,7 @@ Perl_grok_bslash_c(pTHX_ const char source,
6767
clearer[i++] = '\0';
6868

6969
if (packed_warn) {
70-
*message = Perl_form(aTHX_ format, source, clearer);
70+
*message = form(format, source, clearer);
7171
*packed_warn = packWARN(WARN_SYNTAX);
7272
}
7373
else {

gv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2883,7 +2883,7 @@ Perl_newGVgen_flags(pTHX_ const char *pack, U32 flags)
28832883
PERL_ARGS_ASSERT_NEWGVGEN_FLAGS;
28842884
assert(!(flags & ~SVf_UTF8));
28852885

2886-
return gv_fetchpv(Perl_form(aTHX_ "%" UTF8f "::_GEN_%ld",
2886+
return gv_fetchpv(form("%" UTF8f "::_GEN_%ld",
28872887
UTF8fARG(flags, strlen(pack), pack),
28882888
(long)PL_gensym++),
28892889
GV_ADD, SVt_PVGV);

locale.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ static int debug_initialization = 0;
347347
const char * errno_string; \
348348
if (GET_ERRNO == 0) { /* Skip output if both errno types are 0 */ \
349349
if (LIKELY(extended == 0)) errno_string = ""; \
350-
else errno_string = Perl_form(aTHX_ "; $^E=%d", extended); \
350+
else errno_string = form("; $^E=%d", extended); \
351351
} \
352352
else if (LIKELY(extended == GET_ERRNO)) \
353-
errno_string = Perl_form(aTHX_ "; $!=%d", GET_ERRNO); \
354-
else errno_string = Perl_form(aTHX_ "; $!=%d, $^E=%d", \
353+
errno_string = form("; $!=%d", GET_ERRNO); \
354+
else errno_string = form("; $!=%d, $^E=%d", \
355355
GET_ERRNO, extended);
356356
# else
357357
/* Output the errno, if non-zero */
@@ -360,7 +360,7 @@ static int debug_initialization = 0;
360360
const char * errno_string = ""; \
361361
if (GET_ERRNO != 0) { \
362362
dTHX; \
363-
errno_string = Perl_form(aTHX_ "; $!=%d", GET_ERRNO); \
363+
errno_string = form("; $!=%d", GET_ERRNO); \
364364
}
365365
# endif
366366

@@ -956,14 +956,14 @@ S_get_displayable_string(pTHX_
956956
if (cp == ' ' || cp == '\\') {
957957
my_strlcat(ret, "\\", size);
958958
}
959-
my_strlcat(ret, Perl_form(aTHX_ "%c", (U8) cp), size);
959+
my_strlcat(ret, form("%c", (U8) cp), size);
960960
prev_was_printable = TRUE;
961961
}
962962
else {
963963
if (! first_time) {
964964
my_strlcat(ret, " ", size);
965965
}
966-
my_strlcat(ret, Perl_form(aTHX_ "%02" UVXf, cp), size);
966+
my_strlcat(ret, form("%02" UVXf, cp), size);
967967
prev_was_printable = FALSE;
968968
}
969969
t += (is_utf8) ? UTF8SKIP(t) : 1;
@@ -1021,7 +1021,7 @@ S_get_category_index_helper(pTHX_ const int category, bool * succeeded,
10211021
return LC_ALL_INDEX_; /* Arbitrary */
10221022
}
10231023

1024-
locale_panic_via_(Perl_form(aTHX_ "Unknown locale category %d", category),
1024+
locale_panic_via_(form("Unknown locale category %d", category),
10251025
__FILE__, caller_line);
10261026
NOT_REACHED; /* NOTREACHED */
10271027
}
@@ -1096,7 +1096,7 @@ Perl_locale_panic(const char * msg,
10961096
if ( strNE(__FILE__, higher_caller_file)
10971097
|| immediate_caller_line != higher_caller_line)
10981098
{
1099-
called_by = Perl_form(aTHX_ "\nCalled by %s: %" LINE_Tf "\n",
1099+
called_by = form("\nCalled by %s: %" LINE_Tf "\n",
11001100
higher_caller_file, higher_caller_line);
11011101
}
11021102

@@ -1108,15 +1108,15 @@ Perl_locale_panic(const char * msg,
11081108

11091109
const int extended_errnum = get_extended_os_errno();
11101110
if (errno != extended_errnum) {
1111-
errno_text = Perl_form(aTHX_ "; errno=%d, $^E=%d",
1111+
errno_text = form("; errno=%d, $^E=%d",
11121112
errno, extended_errnum);
11131113
}
11141114
else
11151115

11161116
#endif
11171117

11181118
{
1119-
errno_text = Perl_form(aTHX_ "; errno=%d", errno);
1119+
errno_text = form("; errno=%d", errno);
11201120
}
11211121

11221122
/* diag_listed_as: panic: %s */
@@ -1158,7 +1158,7 @@ Perl_locale_panic(const char * msg,
11581158
const char * temp = savepvn(s, len); \
11591159
result = savepv(override_ignored_category(i, temp)); \
11601160
if (action == check_that_overridden && strNE(result, temp)) { \
1161-
locale_panic_(Perl_form(aTHX_ \
1161+
locale_panic_(form( \
11621162
"%s expected to be '%s', instead is '%s'", \
11631163
category_names[i], result, temp)); \
11641164
} \
@@ -1480,7 +1480,7 @@ S_parse_LC_ALL_string(pTHX_ const char * string,
14801480
break;
14811481
}
14821482

1483-
msg = Perl_form(aTHX_ "'%.*s' %s\n",
1483+
msg = form("'%.*s' %s\n",
14841484
(int) (display_end - display_start),
14851485
display_start, msg);
14861486

@@ -2587,7 +2587,7 @@ S_bool_setlocale_2008_i(pTHX_
25872587
* now switch into it */
25882588
if (! uselocale(new_obj)) {
25892589
freelocale(new_obj);
2590-
locale_panic_(Perl_form(aTHX_ "(called from %" LINE_Tf "):"
2590+
locale_panic_(form("(called from %" LINE_Tf "):"
25912591
" bool_setlocale_2008_i: switching"
25922592
" into new locale failed",
25932593
caller_line));
@@ -3142,7 +3142,7 @@ S_calculate_LC_ALL_string(pTHX_ const char ** category_locales_list,
31423142
}
31433143

31443144
/* If would have overflowed, panic */
3145-
locale_panic_via_(Perl_form(aTHX_
3145+
locale_panic_via_(form(
31463146
"Internal length calculation wrong.\n"
31473147
"\"%s\" was not entirely added to"
31483148
" \"%.*s\"; needed=%zu, had=%zu",
@@ -3399,22 +3399,22 @@ S_setlocale_failure_panic_via_i(pTHX_
33993399
const char * proxy_text = "";
34003400
if (proxy_caller_line != 0 && proxy_caller_line != immediate_caller_line)
34013401
{
3402-
proxy_text = Perl_form(aTHX_ "\nCalled via %s: %" LINE_Tf,
3402+
proxy_text = form("\nCalled via %s: %" LINE_Tf,
34033403
__FILE__, proxy_caller_line);
34043404
}
34053405
if ( strNE(__FILE__, higher_caller_file)
34063406
|| ( immediate_caller_line != 0
34073407
&& immediate_caller_line != higher_caller_line))
34083408
{
3409-
proxy_text = Perl_form(aTHX_ "%s\nCalled via %s: %" LINE_Tf,
3409+
proxy_text = form("%s\nCalled via %s: %" LINE_Tf,
34103410
proxy_text, __FILE__,
34113411
immediate_caller_line);
34123412
}
34133413

34143414
/* 'false' in the get_displayable_string() calls makes it not think the
34153415
* locale is UTF-8, so just dumps bytes. Actually figuring it out can be
34163416
* too complicated for a panic situation. */
3417-
const char * msg = Perl_form(aTHX_
3417+
const char * msg = form(
34183418
"Can't change locale for %s (%d) from '%s' to '%s'"
34193419
" %s",
34203420
name, cat,
@@ -3854,7 +3854,7 @@ S_new_ctype(pTHX_ const char *newctype, bool force)
38543854
"Unsupported, MB_CUR_MAX=%d\n", mb_cur_max));
38553855

38563856
if (! IN_LC(LC_CTYPE) || ckWARN_d(WARN_LOCALE)) {
3857-
char * msg = Perl_form(aTHX_
3857+
char * msg = form(
38583858
"Locale '%s' is unsupported, and may hang"
38593859
" or crash the interpreter",
38603860
newctype);
@@ -4619,7 +4619,7 @@ S_my_setlocale_debug_string_i(pTHX_
46194619
# define THREAD_ARGUMENT
46204620
# endif
46214621

4622-
return Perl_form(aTHX_
4622+
return form(
46234623
"%s:%" LINE_Tf ": " THREAD_FORMAT
46244624
" setlocale(%s[%d], %s%s%s) returned %s%s%s\n",
46254625

@@ -4664,7 +4664,7 @@ S_toggle_locale_i(pTHX_ const locale_category_index cat_index,
46644664
caller_line));
46654665

46664666
if (! locale_to_restore_to) {
4667-
locale_panic_via_(Perl_form(aTHX_
4667+
locale_panic_via_(form(
46684668
"Could not find current %s locale",
46694669
category_names[cat_index]),
46704670
__FILE__, caller_line);
@@ -5084,7 +5084,7 @@ S_save_to_buffer(pTHX_ const char * string, char **buf, Size_t *buf_size)
50845084
/* Catch glitches. Usually this is because LC_CTYPE needs to be the same
50855085
* locale as whatever is being worked on */
50865086
if (UNLIKELY(instr(string, REPLACEMENT_CHARACTER_UTF8))) {
5087-
locale_panic_(Perl_form(aTHX_
5087+
locale_panic_(form(
50885088
"Unexpected REPLACEMENT_CHARACTER in '%s'\n%s",
50895089
string, get_LC_ALL_display()));
50905090
}
@@ -5443,7 +5443,7 @@ S_my_localeconv(pTHX_ const int item)
54435443

54445444
switch (item) {
54455445
default:
5446-
locale_panic_(Perl_form(aTHX_
5446+
locale_panic_(form(
54475447
"Unexpected item passed to my_localeconv: %d", item));
54485448
break;
54495449

@@ -6603,7 +6603,7 @@ S_langinfo_sv_i(pTHX_
66036603
* of this bug */
66046604
case CODESET:
66056605
# endif
6606-
locale_panic_(Perl_form(aTHX_
6606+
locale_panic_(form(
66076607
"nl_langinfo returned empty for %ld"
66086608
" in supposed locale \n'%s';"
66096609
" which really is\n'%s'\n"
@@ -6679,7 +6679,7 @@ S_langinfo_sv_i(pTHX_
66796679
* represents even only the first 10 alternative digits, it
66806680
* will be much longer than that. So to reach here, the
66816681
* separator must be some other byte. */
6682-
locale_panic_(Perl_form(aTHX_
6682+
locale_panic_(form(
66836683
"Can't find separator in ALT_DIGITS"
66846684
" representation '%s' for locale '%s'",
66856685
_byte_dump_string((U8 *) retval,
@@ -9030,7 +9030,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
90309030
* malloc'd in the interim. We arbitrarily switch to the C locale,
90319031
* overridden below */
90329032
if (! uselocale(PL_C_locale_obj)) {
9033-
locale_panic_(Perl_form(aTHX_
9033+
locale_panic_(form(
90349034
"Can't uselocale(0x%p), LC_ALL supposed to"
90359035
" be 'C'",
90369036
PL_C_locale_obj));
@@ -10950,7 +10950,7 @@ Perl_switch_locale_context(pTHX)
1095010950
# ifdef USE_POSIX_2008_LOCALE
1095110951

1095210952
if (! uselocale(PL_cur_locale_obj)) {
10953-
locale_panic_(Perl_form(aTHX_
10953+
locale_panic_(form(
1095410954
"Can't uselocale(0x%p), LC_ALL supposed to"
1095510955
" be '%s'",
1095610956
PL_cur_locale_obj, get_LC_ALL_display()));
@@ -10959,7 +10959,7 @@ Perl_switch_locale_context(pTHX)
1095910959
# elif defined(WIN32)
1096010960

1096110961
if (! bool_setlocale_c(LC_ALL, PL_cur_LC_ALL)) {
10962-
locale_panic_(Perl_form(aTHX_ "Can't setlocale(%s)", PL_cur_LC_ALL));
10962+
locale_panic_(form("Can't setlocale(%s)", PL_cur_LC_ALL));
1096310963
}
1096410964

1096510965
# endif
@@ -10991,7 +10991,7 @@ Perl_thread_locale_init(pTHX)
1099110991

1099210992
/* Not being able to change to the C locale is severe; don't keep
1099310993
* going. */
10994-
locale_panic_(Perl_form(aTHX_
10994+
locale_panic_(form(
1099510995
"Can't uselocale(0x%p), 'C'", PL_C_locale_obj));
1099610996
NOT_REACHED; /* NOTREACHED */
1099710997
}

0 commit comments

Comments
 (0)