diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-28 20:13:55 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-28 20:13:55 +0000 |
commit | ef8f7699778dff55cfd4d5ca899723febaa96cd0 (patch) | |
tree | ccef706b0aa4dcaca94de85d13e4e905711a6286 | |
parent | 4c4652b6d968d9437bc85193bd123507e4c83bca (diff) | |
download | perl-ef8f7699778dff55cfd4d5ca899723febaa96cd0.tar.gz |
Eliminate (HV *) casts in u*.c.
p4raw-id: //depot/perl@34624
-rw-r--r-- | universal.c | 8 | ||||
-rw-r--r-- | utf8.c | 6 | ||||
-rw-r--r-- | util.c | 70 |
3 files changed, 42 insertions, 42 deletions
diff --git a/universal.c b/universal.c index a69ab0d180..91ff18f001 100644 --- a/universal.c +++ b/universal.c @@ -462,7 +462,7 @@ XS(XS_UNIVERSAL_VERSION) } if ( vcmp( req, sv ) > 0 ) { - if ( hv_exists((HV*)SvRV(req), "qv", 2 ) ) { + if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) { Perl_croak(aTHX_ "%s version %"SVf" required--" "this is only version %"SVf"", HvNAME_get(pkg), SVfARG(vnormal(req)), @@ -677,7 +677,7 @@ XS(XS_version_is_alpha) SP -= items; if (sv_derived_from(ST(0), "version")) { SV * const lobj = ST(0); - if ( hv_exists((HV*)SvRV(lobj), "alpha", 5 ) ) + if ( hv_exists(MUTABLE_HV(SvRV(lobj)), "alpha", 5 ) ) XSRETURN_YES; else XSRETURN_NO; @@ -884,7 +884,7 @@ XS(XS_Internals_hv_clear_placehold) if (items != 1) croak_xs_usage(cv, "hv"); else { - HV * const hv = (HV *) SvRV(ST(0)); + HV * const hv = MUTABLE_HV(SvRV(ST(0))); hv_clear_placeholders(hv); XSRETURN(0); } @@ -1052,7 +1052,7 @@ XS(XS_Internals_HvREHASH) /* Subject to change */ dXSARGS; PERL_UNUSED_ARG(cv); if (SvROK(ST(0))) { - const HV * const hv = (HV *) SvRV(ST(0)); + const HV * const hv = (const HV *) SvRV(ST(0)); if (items == 1 && SvTYPE(hv) == SVt_PVHV) { if (HvREHASH(hv)) XSRETURN_YES; @@ -1740,7 +1740,7 @@ UV Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8) { dVAR; - HV* const hv = (HV*)SvRV(swash); + HV *const hv = MUTABLE_HV(SvRV(swash)); U32 klen; U32 off; STRLEN slen; @@ -1863,7 +1863,7 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span) SV *swatch; U8 *l, *lend, *x, *xend, *s; STRLEN lcur, xcur, scur; - HV* const hv = (HV*)SvRV(swash); + HV *const hv = MUTABLE_HV(SvRV(swash)); SV** const listsvp = hv_fetchs(hv, "LIST", FALSE); SV** const typesvp = hv_fetchs(hv, "TYPE", FALSE); SV** const bitssvp = hv_fetchs(hv, "BITS", FALSE); @@ -2074,7 +2074,7 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span) } othersvp = hv_fetch(hv, (char *)namestr, namelen, FALSE); - otherhv = (HV*)SvRV(*othersvp); + otherhv = MUTABLE_HV(SvRV(*othersvp)); otherbitssvp = hv_fetchs(otherhv, "BITS", FALSE); otherbits = (STRLEN)SvUV(*otherbitssvp); if (bits < otherbits) @@ -4305,11 +4305,11 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) pos = s; if ( qv ) - (void)hv_stores((HV *)hv, "qv", newSViv(qv)); + (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(qv)); if ( alpha ) - (void)hv_stores((HV *)hv, "alpha", newSViv(alpha)); + (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(alpha)); if ( !qv && width < 3 ) - (void)hv_stores((HV *)hv, "width", newSViv(width)); + (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); while (isDIGIT(*pos)) pos++; @@ -4413,8 +4413,8 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) /* need to save off the current version string for later */ if ( vinf ) { SV * orig = newSVpvn("v.Inf", sizeof("v.Inf")-1); - (void)hv_stores((HV *)hv, "original", orig); - (void)hv_stores((HV *)hv, "vinf", newSViv(1)); + (void)hv_stores(MUTABLE_HV(hv), "original", orig); + (void)hv_stores(MUTABLE_HV(hv), "vinf", newSViv(1)); } else if ( s > start ) { SV * orig = newSVpvn(start,s-start); @@ -4422,15 +4422,15 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) /* need to insert a v to be consistent */ sv_insert(orig, 0, 0, "v", 1); } - (void)hv_stores((HV *)hv, "original", orig); + (void)hv_stores(MUTABLE_HV(hv), "original", orig); } else { - (void)hv_stores((HV *)hv, "original", newSVpvn("0",1)); + (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvn("0",1)); av_push(av, newSViv(0)); } /* And finally, store the AV in the hash */ - (void)hv_stores((HV *)hv, "version", newRV_noinc((SV *)av)); + (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc((SV *)av)); /* fix RT#19517 - special case 'undef' as string */ if ( *s == 'u' && strEQ(s,"undef") ) { @@ -4472,25 +4472,25 @@ Perl_new_version(pTHX_ SV *ver) ver = SvRV(ver); /* Begin copying all of the elements */ - if ( hv_exists((HV *)ver, "qv", 2) ) - (void)hv_stores((HV *)hv, "qv", newSViv(1)); + if ( hv_exists(MUTABLE_HV(ver), "qv", 2) ) + (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(1)); - if ( hv_exists((HV *)ver, "alpha", 5) ) - (void)hv_stores((HV *)hv, "alpha", newSViv(1)); + if ( hv_exists(MUTABLE_HV(ver), "alpha", 5) ) + (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(1)); - if ( hv_exists((HV*)ver, "width", 5 ) ) + if ( hv_exists(MUTABLE_HV(ver), "width", 5 ) ) { - const I32 width = SvIV(*hv_fetchs((HV*)ver, "width", FALSE)); - (void)hv_stores((HV *)hv, "width", newSViv(width)); + const I32 width = SvIV(*hv_fetchs(MUTABLE_HV(ver), "width", FALSE)); + (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); } - if ( hv_exists((HV*)ver, "original", 8 ) ) + if ( hv_exists(MUTABLE_HV(ver), "original", 8 ) ) { - SV * pv = *hv_fetchs((HV*)ver, "original", FALSE); - (void)hv_stores((HV *)hv, "original", newSVsv(pv)); + SV * pv = *hv_fetchs(MUTABLE_HV(ver), "original", FALSE); + (void)hv_stores(MUTABLE_HV(hv), "original", newSVsv(pv)); } - sav = (AV *)SvRV(*hv_fetchs((HV*)ver, "version", FALSE)); + sav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(ver), "version", FALSE)); /* This will get reblessed later if a derived class*/ for ( key = 0; key <= av_len(sav); key++ ) { @@ -4498,7 +4498,7 @@ Perl_new_version(pTHX_ SV *ver) av_push(av, newSViv(rev)); } - (void)hv_stores((HV *)hv, "version", newRV_noinc((SV *)av)); + (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc((SV *)av)); return rv; } #ifdef SvVOK @@ -4646,8 +4646,8 @@ Perl_vverify(pTHX_ SV *vs) /* see if the appropriate elements exist */ if ( SvTYPE(vs) == SVt_PVHV - && hv_exists((HV*)vs, "version", 7) - && (sv = SvRV(*hv_fetchs((HV*)vs, "version", FALSE))) + && hv_exists(MUTABLE_HV(vs), "version", 7) + && (sv = SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) && SvTYPE(sv) == SVt_PVAV ) return TRUE; else @@ -4686,16 +4686,16 @@ Perl_vnumify(pTHX_ SV *vs) Perl_croak(aTHX_ "Invalid version object"); /* see if various flags exist */ - if ( hv_exists((HV*)vs, "alpha", 5 ) ) + if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) alpha = TRUE; - if ( hv_exists((HV*)vs, "width", 5 ) ) - width = SvIV(*hv_fetchs((HV*)vs, "width", FALSE)); + if ( hv_exists(MUTABLE_HV(vs), "width", 5 ) ) + width = SvIV(*hv_fetchs(MUTABLE_HV(vs), "width", FALSE)); else width = 3; /* attempt to retrieve the version array */ - if ( !(av = (AV *)SvRV(*hv_fetchs((HV*)vs, "version", FALSE)) ) ) { + if ( !(av = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE)) ) ) { sv_catpvs(sv,"0"); return sv; } @@ -4766,9 +4766,9 @@ Perl_vnormal(pTHX_ SV *vs) if ( !vverify(vs) ) Perl_croak(aTHX_ "Invalid version object"); - if ( hv_exists((HV*)vs, "alpha", 5 ) ) + if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) alpha = TRUE; - av = (AV *)SvRV(*hv_fetchs((HV*)vs, "version", FALSE)); + av = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE)); len = av_len(av); if ( len == -1 ) @@ -4822,16 +4822,16 @@ Perl_vstringify(pTHX_ SV *vs) if ( !vverify(vs) ) Perl_croak(aTHX_ "Invalid version object"); - if (hv_exists((HV*)vs, "original", sizeof("original") - 1)) { + if (hv_exists(MUTABLE_HV(vs), "original", sizeof("original") - 1)) { SV *pv; - pv = *hv_fetchs((HV*)vs, "original", FALSE); + pv = *hv_fetchs(MUTABLE_HV(vs), "original", FALSE); if ( SvPOK(pv) ) return newSVsv(pv); else return &PL_sv_undef; } else { - if ( hv_exists((HV *)vs, "qv", 2) ) + if ( hv_exists(MUTABLE_HV(vs), "qv", 2) ) return vnormal(vs); else return vnumify(vs); @@ -4871,13 +4871,13 @@ Perl_vcmp(pTHX_ SV *lhv, SV *rhv) Perl_croak(aTHX_ "Invalid version object"); /* get the left hand term */ - lav = (AV *)SvRV(*hv_fetchs((HV*)lhv, "version", FALSE)); - if ( hv_exists((HV*)lhv, "alpha", 5 ) ) + lav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(lhv), "version", FALSE)); + if ( hv_exists(MUTABLE_HV(lhv), "alpha", 5 ) ) lalpha = TRUE; /* and the right hand term */ - rav = (AV *)SvRV(*hv_fetchs((HV*)rhv, "version", FALSE)); - if ( hv_exists((HV*)rhv, "alpha", 5 ) ) + rav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(rhv), "version", FALSE)); + if ( hv_exists(MUTABLE_HV(rhv), "alpha", 5 ) ) ralpha = TRUE; l = av_len(lav); |