This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update gellyfish's e-mail.
[perl5.git] / xsutils.c
index 583527a..1864050 100644 (file)
--- a/xsutils.c
+++ b/xsutils.c
@@ -120,7 +120,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs)
                    break;
                case 'e':
                    if (memEQ(name, "uniqu", 5)) {
-                       if (SvTYPE(sv) == SVt_PVGV) {
+                       if (isGV_with_GP(sv)) {
                            if (negated) {
                                GvUNIQUE_off(sv);
                            } else {
@@ -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);
@@ -221,7 +216,7 @@ usage:
            XPUSHs(newSVpvs_flags("unique", SVs_TEMP));
        break;
     case SVt_PVGV:
-       if (GvUNIQUE(sv))
+       if (isGV_with_GP(sv) && GvUNIQUE(sv))
            XPUSHs(newSVpvs_flags("unique", SVs_TEMP));
        break;
     default:
@@ -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);
@@ -267,7 +260,7 @@ usage:
                stash = CvSTASH(sv);
            break;
        case SVt_PVGV:
-           if (GvGP(sv) && GvESTASH((GV*)sv))
+           if (isGV_with_GP(sv) && GvGP(sv) && GvESTASH((GV*)sv))
                stash = GvESTASH((GV*)sv);
            break;
        default:
@@ -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);