Skip to content

Commit 06c3a62

Browse files
Leontmauke
authored andcommitted
Dont call Perl_croak manually in core
Just call croak instead, we've been able to do that for vararg functions since d933027
1 parent 24ec8e7 commit 06c3a62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+612
-614
lines changed

av.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
9999
PERL_ARGS_ASSERT_AV_EXTEND_GUTS;
100100

101101
if (key < -1) /* -1 is legal */
102-
Perl_croak(aTHX_
102+
croak(
103103
"panic: av_extend_guts() negative count (%" IVdf ")", (IV)key);
104104

105105
if (key > *maxp) {

builtin.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,19 +308,19 @@ XS(XS_builtin_export_lexically)
308308
warn_experimental_builtin("export_lexically");
309309

310310
if(!PL_compcv)
311-
Perl_croak(aTHX_
311+
croak(
312312
"export_lexically can only be called at compile time");
313313

314314
if(items % 2)
315-
Perl_croak(aTHX_ "Odd number of elements in export_lexically");
315+
croak("Odd number of elements in export_lexically");
316316

317317
for(int i = 0; i < items; i += 2) {
318318
SV *name = ST(i);
319319
SV *ref = ST(i+1);
320320

321321
if(!SvROK(ref))
322322
/* diag_listed_as: Expected %s reference in export_lexically */
323-
Perl_croak(aTHX_ "Expected a reference in export_lexically");
323+
croak("Expected a reference in export_lexically");
324324

325325
char sigil = SvPVX(name)[0];
326326
SV *rv = SvRV(ref);
@@ -358,7 +358,7 @@ XS(XS_builtin_export_lexically)
358358
}
359359

360360
if(bad)
361-
Perl_croak(aTHX_ "Expected %s reference in export_lexically", bad);
361+
croak("Expected %s reference in export_lexically", bad);
362362
}
363363

364364
prepare_export_lexical();
@@ -695,7 +695,7 @@ static void S_import_sym(pTHX_ SV *sym)
695695

696696
CV *cv = get_cv(SvPV_nolen(fqname), SvUTF8(fqname) ? SVf_UTF8 : 0);
697697
if(!cv)
698-
Perl_croak(aTHX_ builtin_not_recognised, sym);
698+
croak(builtin_not_recognised, sym);
699699

700700
export_lexical(ampname, (SV *)cv);
701701
}
@@ -737,7 +737,7 @@ XS(XS_builtin_import)
737737
dXSARGS;
738738

739739
if(!PL_compcv)
740-
Perl_croak(aTHX_
740+
croak(
741741
"builtin::import can only be called at compile time");
742742

743743
prepare_export_lexical();
@@ -747,19 +747,19 @@ XS(XS_builtin_import)
747747
STRLEN symlen;
748748
const char *sympv = SvPV(sym, symlen);
749749
if(strEQ(sympv, "import"))
750-
Perl_croak(aTHX_ builtin_not_recognised, sym);
750+
croak(builtin_not_recognised, sym);
751751

752752
if(sympv[0] == ':') {
753753
UV vmajor, vminor;
754754
if(!S_parse_version(sympv + 1, sympv + symlen, &vmajor, &vminor))
755-
Perl_croak(aTHX_ "Invalid version bundle %" SVf_QUOTEDPREFIX, sym);
755+
croak("Invalid version bundle %" SVf_QUOTEDPREFIX, sym);
756756

757757
U16 want_ver = SHORTVER(vmajor, vminor);
758758

759759
if(want_ver < SHORTVER(5,39) ||
760760
/* round up devel version to next major release; e.g. 5.39 => 5.40 */
761761
want_ver > SHORTVER(PERL_REVISION, PERL_VERSION + (PERL_VERSION % 2)))
762-
Perl_croak(aTHX_ "Builtin version bundle \"%s\" is not supported by Perl " PERL_VERSION_STRING,
762+
croak("Builtin version bundle \"%s\" is not supported by Perl " PERL_VERSION_STRING,
763763
sympv);
764764

765765
import_builtin_bundle(want_ver);

class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ XS(injected_constructor)
145145
HvNAMEfARG(stash));
146146

147147
if (!aux->xhv_class_initfields_cv) {
148-
Perl_croak(aTHX_ "Cannot create an object of incomplete class %" HvNAMEf_QUOTEDPREFIX,
148+
croak("Cannot create an object of incomplete class %" HvNAMEf_QUOTEDPREFIX,
149149
HvNAMEfARG(stash));
150150
}
151151

cygwin/cygwin.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ XS(Cygwin_cwd)
217217
There is Cwd->cwd() usage in the wild, and previous versions didn't die.
218218
*/
219219
if(items > 1)
220-
Perl_croak(aTHX_ "Usage: Cwd::cwd()");
220+
croak("Usage: Cwd::cwd()");
221221
if((cwd = getcwd(NULL, -1))) {
222222
ST(0) = sv_2mortal(newSVpv(cwd, 0));
223223
free(cwd);
@@ -234,7 +234,7 @@ XS(XS_Cygwin_pid_to_winpid)
234234
pid_t pid, RETVAL;
235235

236236
if (items != 1)
237-
Perl_croak(aTHX_ "Usage: Cygwin::pid_to_winpid(pid)");
237+
croak("Usage: Cygwin::pid_to_winpid(pid)");
238238

239239
pid = (pid_t)SvIV(ST(0));
240240

@@ -252,7 +252,7 @@ XS(XS_Cygwin_winpid_to_pid)
252252
pid_t pid, RETVAL;
253253

254254
if (items != 1)
255-
Perl_croak(aTHX_ "Usage: Cygwin::winpid_to_pid(pid)");
255+
croak("Usage: Cygwin::winpid_to_pid(pid)");
256256

257257
pid = (pid_t)SvIV(ST(0));
258258

@@ -293,15 +293,15 @@ S_convert_path_common(pTHX_ const direction_t direction)
293293
const char *name = (direction == to_posix)
294294
? "win::win_to_posix_path"
295295
: "posix_to_win_path";
296-
Perl_croak(aTHX_ "Usage: Cygwin::%s(pathname, [absolute])", name);
296+
croak("Usage: Cygwin::%s(pathname, [absolute])", name);
297297
}
298298

299299
src_path = SvPVx(ST(0), len);
300300
if (items == 2)
301301
absolute_flag = SvTRUE(ST(1));
302302

303303
if (!len)
304-
Perl_croak(aTHX_ "can't convert empty path");
304+
croak("can't convert empty path");
305305
isutf8 = SvUTF8(ST(0));
306306

307307
#if HAVE_CYGWIN_VERSION(0, 181)
@@ -411,7 +411,7 @@ XS(XS_Cygwin_mount_table)
411411
struct mntent *mnt;
412412

413413
if (items != 0)
414-
Perl_croak(aTHX_ "Usage: Cygwin::mount_table");
414+
croak("Usage: Cygwin::mount_table");
415415
/* => array of [mnt_dir mnt_fsname mnt_type mnt_opts] */
416416

417417
setmntent (0, 0);
@@ -435,7 +435,7 @@ XS(XS_Cygwin_mount_flags)
435435
flags[0] = '\0';
436436

437437
if (items != 1)
438-
Perl_croak(aTHX_ "Usage: Cygwin::mount_flags( mnt_dir | '/cygdrive' )");
438+
croak("Usage: Cygwin::mount_flags( mnt_dir | '/cygdrive' )");
439439

440440
pathname = SvPV_nolen(ST(0));
441441

@@ -513,7 +513,7 @@ XS(XS_Cygwin_is_binmount)
513513
char *pathname;
514514

515515
if (items != 1)
516-
Perl_croak(aTHX_ "Usage: Cygwin::is_binmount(pathname)");
516+
croak("Usage: Cygwin::is_binmount(pathname)");
517517

518518
pathname = SvPV_nolen(ST(0));
519519

0 commit comments

Comments
 (0)