summaryrefslogtreecommitdiff
path: root/xsutils.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-05-21 13:35:43 +0000
committerNicholas Clark <nick@ccl4.org>2008-05-21 13:35:43 +0000
commitafa74d4282044c64ab152392003f47bb0674abd2 (patch)
treedae202bcf5f0624235f7d7446c5eef9e30288694 /xsutils.c
parent79706302bf1cd487fc44c6b9085b2f2ba0fa11ff (diff)
downloadperl-afa74d4282044c64ab152392003f47bb0674abd2.tar.gz
Add Perl_croak_xs_usage(), which reduces a lot of explicit calls of
the form Perl_croak(aTHX_ "Usage %s::%s(%s)", "ouch" "awk", "eee_yow"); down to croak_xs_usage(cv, "eee_yow"); and refactor all the core XS code to use it. This adds () to the error messages for attributes::* p4raw-id: //depot/perl@33901
Diffstat (limited to 'xsutils.c')
-rw-r--r--xsutils.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/xsutils.c b/xsutils.c
index 583527a35f..dcc8d09d8d 100644
--- a/xsutils.c
+++ b/xsutils.c
@@ -150,10 +150,9 @@ XS(XS_attributes_bootstrap)
{
dVAR;
dXSARGS;
- PERL_UNUSED_ARG(cv);
if( items > 1 )
- Perl_croak(aTHX_ "Usage: attributes::bootstrap $module");
+ croak_xs_usage(cv, "$module");
newXS("attributes::_modify_attrs", XS_attributes__modify_attrs, file);
newXSproto("attributes::_guess_stash", XS_attributes__guess_stash, file, "$");
@@ -168,12 +167,10 @@ XS(XS_attributes__modify_attrs)
dVAR;
dXSARGS;
SV *rv, *sv;
- PERL_UNUSED_ARG(cv);
if (items < 1) {
usage:
- Perl_croak(aTHX_
- "Usage: attributes::_modify_attrs $reference, @attributes");
+ croak_xs_usage(cv, "@attributes");
}
rv = ST(0);
@@ -192,12 +189,10 @@ XS(XS_attributes__fetch_attrs)
dXSARGS;
SV *rv, *sv;
cv_flags_t cvflags;
- PERL_UNUSED_ARG(cv);
if (items != 1) {
usage:
- Perl_croak(aTHX_
- "Usage: attributes::_fetch_attrs $reference");
+ croak_xs_usage(cv, "$reference");
}
rv = ST(0);
@@ -237,12 +232,10 @@ XS(XS_attributes__guess_stash)
dXSARGS;
SV *rv, *sv;
dXSTARG;
- PERL_UNUSED_ARG(cv);
if (items != 1) {
usage:
- Perl_croak(aTHX_
- "Usage: attributes::_guess_stash $reference");
+ croak_xs_usage(cv, "$reference");
}
rv = ST(0);
@@ -287,12 +280,10 @@ XS(XS_attributes_reftype)
dXSARGS;
SV *rv, *sv;
dXSTARG;
- PERL_UNUSED_ARG(cv);
if (items != 1) {
usage:
- Perl_croak(aTHX_
- "Usage: attributes::reftype $reference");
+ croak_xs_usage(cv, "$reference");
}
rv = ST(0);