bool
Perl_sv_derived_from(pTHX_ SV *sv, const char *name)
{
- char *type;
+ const char *type;
HV *stash;
HV *name_stash;
void
Perl_boot_core_UNIVERSAL(pTHX)
{
- char *file = __FILE__;
+ const char file[] = __FILE__;
newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file);
newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file);
{
dXSARGS;
SV *sv;
- char *name;
+ const char *name;
STRLEN n_a;
+ (void)cv;
if (items != 2)
Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)");
|| (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
XSRETURN_UNDEF;
- name = (char *)SvPV(ST(1),n_a);
+ name = (const char *)SvPV(ST(1),n_a);
ST(0) = boolSV(sv_derived_from(sv, name));
XSRETURN(1);
{
dXSARGS;
SV *sv;
- char *name;
+ const char *name;
SV *rv;
HV *pkg = NULL;
STRLEN n_a;
+ (void)cv;
if (items != 2)
Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)");
|| (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
XSRETURN_UNDEF;
- name = (char *)SvPV(ST(1),n_a);
+ name = (const char *)SvPV(ST(1),n_a);
rv = &PL_sv_undef;
if (SvROK(sv)) {
GV **gvp;
GV *gv;
SV *sv;
- char *undef;
+ const char *undef;
+ (void)cv;
if (SvROK(ST(0))) {
sv = (SV*)SvRV(ST(0));
"%s does not define $%s::VERSION--version check failed",
HvNAME(pkg), HvNAME(pkg));
else {
- char *str = SvPVx(ST(0), len);
+ const char *str = SvPVx(ST(0), len);
Perl_croak(aTHX_
"%s defines neither package nor VERSION--version check failed", str);
XS(XS_version_new)
{
dXSARGS;
+ (void)cv;
if (items > 3)
Perl_croak(aTHX_ "Usage: version::new(class, version)");
SP -= items;
{
- char * class = (char *)SvPV_nolen(ST(0));
+ const char *classname = SvPV_nolen(ST(0));
SV *vs = ST(1);
SV *rv;
if (items == 3 )
}
rv = new_version(vs);
- if ( strcmp(class,"version") != 0 ) /* inherited new() */
- sv_bless(rv, gv_stashpv(class,TRUE));
+ if ( strcmp(classname,"version") != 0 ) /* inherited new() */
+ sv_bless(rv, gv_stashpv(classname,TRUE));
PUSHs(sv_2mortal(rv));
PUTBACK;
XS(XS_version_stringify)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::stringify(lobj, ...)");
SP -= items;
XS(XS_version_numify)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::numify(lobj, ...)");
SP -= items;
XS(XS_version_vcmp)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::vcmp(lobj, ...)");
SP -= items;
XS(XS_version_boolean)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::boolean(lobj, ...)");
SP -= items;
SV * lobj;
if (sv_derived_from(ST(0), "version")) {
+ /* XXX If tmp serves a purpose, explain it. */
SV *tmp = SvRV(ST(0));
lobj = tmp;
}
XS(XS_version_noop)
{
dXSARGS;
+ (void)cv;
if (items < 1)
Perl_croak(aTHX_ "Usage: version::noop(lobj, ...)");
{
XS(XS_version_is_alpha)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: version::is_alpha(lobj)");
SP -= items;
SV *lobj;
if (sv_derived_from(ST(0), "version")) {
+ /* XXX If tmp serves a purpose, explain it. */
SV *tmp = SvRV(ST(0));
lobj = tmp;
}
else
Perl_croak(aTHX_ "lobj is not of type version");
{
- I32 len = av_len((AV *)lobj);
- I32 digit = SvIVX(*av_fetch((AV *)lobj, len, 0));
+ const I32 len = av_len((AV *)lobj);
+ const I32 digit = SvIVX(*av_fetch((AV *)lobj, len, 0));
if ( digit < 0 )
XSRETURN_YES;
else
XS(XS_version_qv)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: version::qv(ver)");
SP -= items;
XS(XS_utf8_is_utf8)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::is_utf8(sv)");
{
- SV * sv = ST(0);
+ const SV *sv = ST(0);
{
if (SvUTF8(sv))
XSRETURN_YES;
XS(XS_utf8_valid)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::valid(sv)");
{
SV * sv = ST(0);
{
STRLEN len;
- char *s = SvPV(sv,len);
- if (!SvUTF8(sv) || is_utf8_string((U8*)s,len))
+ const char *s = SvPV(sv,len);
+ if (!SvUTF8(sv) || is_utf8_string((const U8*)s,len))
XSRETURN_YES;
else
XSRETURN_NO;
XS(XS_utf8_encode)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::encode(sv)");
{
XS(XS_utf8_decode)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::decode(sv)");
{
SV * sv = ST(0);
- bool RETVAL;
-
- RETVAL = sv_utf8_decode(sv);
+ const bool RETVAL = sv_utf8_decode(sv);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XS(XS_utf8_upgrade)
{
dXSARGS;
+ (void)cv;
if (items != 1)
Perl_croak(aTHX_ "Usage: utf8::upgrade(sv)");
{
XS(XS_utf8_downgrade)
{
dXSARGS;
+ (void)cv;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: utf8::downgrade(sv, failok=0)");
{
SV * sv = ST(0);
- bool failok;
- bool RETVAL;
-
- if (items < 2)
- failok = 0;
- else {
- failok = (int)SvIV(ST(1));
- }
+ const bool failok = (items < 2) ? 0 : (int)SvIV(ST(1));
+ const bool RETVAL = sv_utf8_downgrade(sv, failok);
- RETVAL = sv_utf8_downgrade(sv, failok);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XS(XS_utf8_native_to_unicode)
{
dXSARGS;
- UV uv = SvUV(ST(0));
+ const UV uv = SvUV(ST(0));
+ (void)cv;
if (items > 1)
Perl_croak(aTHX_ "Usage: utf8::native_to_unicode(sv)");
XS(XS_utf8_unicode_to_native)
{
dXSARGS;
- UV uv = SvUV(ST(0));
+ const UV uv = SvUV(ST(0));
+ (void)cv;
if (items > 1)
Perl_croak(aTHX_ "Usage: utf8::unicode_to_native(sv)");
{
dXSARGS;
SV *sv = SvRV(ST(0));
+ (void)cv;
+
if (items == 1) {
if (SvREADONLY(sv))
XSRETURN_YES;
{
dXSARGS;
SV *sv = SvRV(ST(0));
+ (void)cv;
+
if (items == 1)
XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */
else if (items == 2) {
{
dXSARGS;
HV *hv = (HV *) SvRV(ST(0));
+ (void)cv;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: UNIVERSAL::hv_clear_placeholders(hv)");
hv_clear_placeholders(hv);
XS(XS_Regexp_DESTROY)
{
-
+ (void)cv;
}
XS(XS_PerlIO_get_layers)
{
dXSARGS;
+ (void)cv;
if (items < 1 || items % 2 == 0)
Perl_croak(aTHX_ "Usage: PerlIO_get_layers(filehandle[,args])");
#ifdef USE_PERLIO
SV **varp = svp;
SV **valp = svp + 1;
STRLEN klen;
- char *key = SvPV(*varp, klen);
+ const char *key = SvPV(*varp, klen);
switch (*key) {
case 'i':
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dMARK; dAX;
+ (void)cv;
XSRETURN_UV(PERL_HASH_SEED);
}
/* Using dXSARGS would also have dITEM and dSP,
* which define 2 unused local variables. */
dMARK; dAX;
+ (void)cv;
XSRETURN_UV(PL_rehash_seed);
}
XS(XS_Internals_HvREHASH) /* Subject to change */
{
dXSARGS;
+ (void)cv;
if (SvROK(ST(0))) {
- HV *hv = (HV *) SvRV(ST(0));
+ const HV *hv = (HV *) SvRV(ST(0));
if (items == 1 && SvTYPE(hv) == SVt_PVHV) {
if (HvREHASH(hv))
XSRETURN_YES;
* indent-tabs-mode: t
* End:
*
- * vim: expandtab shiftwidth=4:
+ * vim: shiftwidth=4:
*/