Change 34629 by [EMAIL PROTECTED] on 2008/10/28 22:14:26 Every remaining (HV *) cast in *.c
Affected files ... ... //depot/perl/doop.c#203 edit ... //depot/perl/dump.c#312 edit ... //depot/perl/gv.c#400 edit ... //depot/perl/hv.c#383 edit ... //depot/perl/mathoms.c#89 edit ... //depot/perl/mg.c#533 edit ... //depot/perl/mro.c#55 edit ... //depot/perl/op.c#1011 edit ... //depot/perl/pad.c#123 edit ... //depot/perl/perl.c#879 edit ... //depot/perl/pp.c#632 edit ... //depot/perl/pp_ctl.c#700 edit ... //depot/perl/pp_hot.c#580 edit ... //depot/perl/pp_sys.c#563 edit ... //depot/perl/regcomp.c#663 edit ... //depot/perl/regexec.c#572 edit ... //depot/perl/scope.c#228 edit ... //depot/perl/sv.c#1563 edit Differences ... ==== //depot/perl/doop.c#203 (text) ==== Index: perl/doop.c --- perl/doop.c#202~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/doop.c 2008-10-28 15:14:26.000000000 -0700 @@ -318,7 +318,7 @@ #else (SV*)cSVOP->op_sv; #endif - HV* const hv = (HV*)SvRV(rv); + HV* const hv = MUTABLE_HV(SvRV(rv)); SV* const * svp = hv_fetchs(hv, "NONE", FALSE); const UV none = svp ? SvUV(*svp) : 0x7fffffff; const UV extra = none + 1; @@ -420,7 +420,7 @@ #else (SV*)cSVOP->op_sv; #endif - HV* const hv = (HV*)SvRV(rv); + HV* const hv = MUTABLE_HV(SvRV(rv)); SV* const * const svp = hv_fetchs(hv, "NONE", FALSE); const UV none = svp ? SvUV(*svp) : 0x7fffffff; const UV extra = none + 1; @@ -471,7 +471,7 @@ #else (SV*)cSVOP->op_sv; #endif - HV * const hv = (HV*)SvRV(rv); + HV * const hv = MUTABLE_HV(SvRV(rv)); SV * const *svp = hv_fetchs(hv, "NONE", FALSE); const UV none = svp ? SvUV(*svp) : 0x7fffffff; const UV extra = none + 1; @@ -1009,7 +1009,7 @@ return; } else if (SvTYPE(sv) == SVt_PVHV) { - HV* const hv = (HV*)sv; + HV* const hv = MUTABLE_HV(sv); HE* entry; (void)hv_iterinit(hv); while ((entry = hv_iternext(hv))) @@ -1095,7 +1095,7 @@ return count; } else if (SvTYPE(sv) == SVt_PVHV) { - HV* const hv = (HV*)sv; + HV* const hv = MUTABLE_HV(sv); HE* entry; (void)hv_iterinit(hv); while ((entry = hv_iternext(hv))) @@ -1431,7 +1431,7 @@ { dVAR; dSP; - HV * const hv = (HV*)POPs; + HV * const hv = MUTABLE_HV(POPs); HV *keys; register HE *entry; const I32 gimme = GIMME_V; ==== //depot/perl/dump.c#312 (text) ==== Index: perl/dump.c --- perl/dump.c#311~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/dump.c 2008-10-28 15:14:26.000000000 -0700 @@ -1753,7 +1753,8 @@ Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", hvname); } if (SvOOK(sv)) { - const AV * const backrefs = *Perl_hv_backreferences_p(aTHX_ (HV*)sv); + const AV * const backrefs + = *Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(sv)); if (backrefs) { Perl_dump_indent(aTHX_ level, file, " BACKREFS = 0x%"UVxf"\n", PTR2UV(backrefs)); @@ -1763,7 +1764,7 @@ } if (nest < maxnest && !HvEITER_get(sv)) { /* Try to preserve iterator */ HE *he; - HV * const hv = (HV*)sv; + HV * const hv = MUTABLE_HV(sv); int count = maxnest - nest; hv_iterinit(hv); ==== //depot/perl/gv.c#400 (text) ==== Index: perl/gv.c --- perl/gv.c#399~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/gv.c 2008-10-28 15:14:26.000000000 -0700 @@ -1511,7 +1511,7 @@ /* unless exists($main::{FileHandle}) and defined(%main::FileHandle::) */ if (!(iogv && GvHV(iogv) && HvARRAY(GvHV(iogv)))) iogv = gv_fetchpvs("IO::Handle::", GV_ADD, SVt_PVHV); - SvSTASH_set(io, (HV*)SvREFCNT_inc(GvHV(iogv))); + SvSTASH_set(io, MUTABLE_HV(SvREFCNT_inc(GvHV(iogv)))); return io; } @@ -1922,7 +1922,7 @@ Hence we can't use SvAMAGIC_on() */ SvFLAGS(newref) |= SVf_AMAGIC; - SvSTASH_set(newref, (HV*)SvREFCNT_inc(SvSTASH(tmpRef))); + SvSTASH_set(newref, MUTABLE_HV(SvREFCNT_inc(SvSTASH(tmpRef)))); return newref; } } ==== //depot/perl/hv.c#383 (text) ==== Index: perl/hv.c --- perl/hv.c#382~34618~ 2008-10-28 11:29:36.000000000 -0700 +++ perl/hv.c 2008-10-28 15:14:26.000000000 -0700 @@ -866,7 +866,7 @@ } sv = sv_newmortal(); - if (HvFILL((HV*)hv)) + if (HvFILL((const HV *)hv)) Perl_sv_setpvf(aTHX_ sv, "%ld/%ld", (long)HvFILL(hv), (long)HvMAX(hv) + 1); else ==== //depot/perl/mathoms.c#89 (text) ==== Index: perl/mathoms.c --- perl/mathoms.c#88~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/mathoms.c 2008-10-28 15:14:26.000000000 -0700 @@ -1455,7 +1455,7 @@ HV * Perl_newHV(pTHX) { - HV * const hv = (HV*)newSV_type(SVt_PVHV); + HV * const hv = MUTABLE_HV(newSV_type(SVt_PVHV)); assert(!SvOK(hv)); return hv; ==== //depot/perl/mg.c#533 (text) ==== Index: perl/mg.c --- perl/mg.c#532~34604~ 2008-10-27 13:22:36.000000000 -0700 +++ perl/mg.c 2008-10-28 15:14:26.000000000 -0700 @@ -1197,11 +1197,11 @@ if (PL_localizing) { HE* entry; my_clearenv(); - hv_iterinit((HV*)sv); - while ((entry = hv_iternext((HV*)sv))) { + hv_iterinit(MUTABLE_HV(sv)); + while ((entry = hv_iternext(MUTABLE_HV(sv)))) { I32 keylen; my_setenv(hv_iterkey(entry, &keylen), - SvPV_nolen_const(hv_iterval((HV*)sv, entry))); + SvPV_nolen_const(hv_iterval(MUTABLE_HV(sv), entry))); } } #endif @@ -1633,7 +1633,7 @@ int Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg) { - HV * const hv = (HV*)LvTARG(sv); + HV * const hv = MUTABLE_HV(LvTARG(sv)); I32 i = 0; PERL_ARGS_ASSERT_MAGIC_GETNKEYS; @@ -1659,7 +1659,7 @@ PERL_ARGS_ASSERT_MAGIC_SETNKEYS; PERL_UNUSED_ARG(mg); if (LvTARG(sv)) { - hv_ksplit((HV*)LvTARG(sv), SvIV(sv)); + hv_ksplit(MUTABLE_HV(LvTARG(sv)), SvIV(sv)); } return 0; } @@ -2159,7 +2159,7 @@ if (LvTARGLEN(sv)) { if (mg->mg_obj) { SV * const ahv = LvTARG(sv); - HE * const he = hv_fetch_ent((HV*)ahv, mg->mg_obj, FALSE, 0); + HE * const he = hv_fetch_ent(MUTABLE_HV(ahv), mg->mg_obj, FALSE, 0); if (he) targ = HeVAL(he); } @@ -2211,7 +2211,7 @@ return; if (mg->mg_obj) { SV * const ahv = LvTARG(sv); - HE * const he = hv_fetch_ent((HV*)ahv, mg->mg_obj, TRUE, 0); + HE * const he = hv_fetch_ent(MUTABLE_HV(ahv), mg->mg_obj, TRUE, 0); if (he) value = HeVAL(he); if (!value || value == &PL_sv_undef) ==== //depot/perl/mro.c#55 (text) ==== Index: perl/mro.c --- perl/mro.c#54~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/mro.c 2008-10-28 15:14:26.000000000 -0700 @@ -88,10 +88,10 @@ = (AV*) SvREFCNT_inc(sv_dup((SV*)newmeta->mro_linear_c3, param)); if (newmeta->mro_nextmethod) newmeta->mro_nextmethod - = (HV*) SvREFCNT_inc(sv_dup((SV*)newmeta->mro_nextmethod, param)); + = MUTABLE_HV(SvREFCNT_inc(sv_dup((SV*)newmeta->mro_nextmethod, param))); if (newmeta->isa) newmeta->isa - = (HV*) SvREFCNT_inc(sv_dup((SV*)newmeta->isa, param)); + = MUTABLE_HV(SvREFCNT_inc(sv_dup((SV*)newmeta->isa, param))); return newmeta; } @@ -197,7 +197,7 @@ It's then retained to be re-used as a fast lookup for ->isa(), by adding our own name and "UNIVERSAL" to it. */ - stored = (HV*)sv_2mortal((SV*)newHV()); + stored = MUTABLE_HV(sv_2mortal((SV*)newHV())); if(av && AvFILLp(av) >= 0) { @@ -344,7 +344,7 @@ if(isa && AvFILLp(isa) >= 0) { SV** seqs_ptr; I32 seqs_items; - HV* const tails = (HV*)sv_2mortal((SV*)newHV()); + HV* const tails = MUTABLE_HV(sv_2mortal((SV*)newHV())); AV* const seqs = (AV*)sv_2mortal((SV*)newAV()); I32* heads; @@ -582,7 +582,7 @@ is UNIVERSAL or one of its parents */ svp = hv_fetch(PL_isarev, stashname, stashname_len, 0); - isarev = svp ? (HV*)*svp : NULL; + isarev = svp ? MUTABLE_HV(*svp) : NULL; if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL")) || (isarev && hv_exists(isarev, "UNIVERSAL", 9))) { @@ -641,7 +641,7 @@ us, then will need to upgrade it to an HV (which sv_upgrade() can now do for us. */ - mroisarev = (HV*)HeVAL(he); + mroisarev = MUTABLE_HV(HeVAL(he)); SvUPGRADE((SV*)mroisarev, SVt_PVHV); @@ -700,7 +700,7 @@ const STRLEN stashname_len = HvNAMELEN_get(stash); SV ** const svp = hv_fetch(PL_isarev, stashname, stashname_len, 0); - HV * const isarev = svp ? (HV*)*svp : NULL; + HV * const isarev = svp ? MUTABLE_HV(*svp) : NULL; PERL_ARGS_ASSERT_MRO_METHOD_CHANGED_IN; @@ -891,7 +891,7 @@ he = hv_fetch_ent(PL_isarev, classname, 0, 0); - isarev = he ? (HV*)HeVAL(he) : NULL; + isarev = he ? MUTABLE_HV(HeVAL(he)) : NULL; ret_array = newAV(); if(isarev) { @@ -924,7 +924,7 @@ classname_pv = SvPV(classname,classname_len); he = hv_fetch_ent(PL_isarev, classname, 0, 0); - isarev = he ? (HV*)HeVAL(he) : NULL; + isarev = he ? MUTABLE_HV(HeVAL(he)) : NULL; if((classname_len == 9 && strEQ(classname_pv, "UNIVERSAL")) || (isarev && hv_exists(isarev, "UNIVERSAL", 9))) ==== //depot/perl/op.c#1011 (text) ==== Index: perl/op.c --- perl/op.c#1010~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/op.c 2008-10-28 15:14:26.000000000 -0700 @@ -3361,7 +3361,7 @@ SvREFCNT_dec(transv); if (!del && havefinal && rlen) - (void)hv_store((HV*)SvRV(swash), "FINAL", 5, + (void)hv_store(MUTABLE_HV(SvRV(swash)), "FINAL", 5, newSVuv((UV)final), 0); if (grows) ==== //depot/perl/pad.c#123 (text) ==== Index: perl/pad.c --- perl/pad.c#122~34600~ 2008-10-26 15:20:48.000000000 -0700 +++ perl/pad.c 2008-10-28 15:14:26.000000000 -0700 @@ -367,7 +367,7 @@ if (typestash) { assert(SvTYPE(namesv) == SVt_PVMG); SvPAD_TYPED_on(namesv); - SvSTASH_set(namesv, (HV*)SvREFCNT_inc_simple_NN((SV*)typestash)); + SvSTASH_set(namesv, MUTABLE_HV(SvREFCNT_inc_simple_NN((SV*)typestash))); } if (ourstash) { SvPAD_OUR_on(namesv); ==== //depot/perl/perl.c#879 (text) ==== Index: perl/perl.c --- perl/perl.c#878~34595~ 2008-10-26 06:32:20.000000000 -0700 +++ perl/perl.c 2008-10-28 15:14:26.000000000 -0700 @@ -3546,7 +3546,7 @@ of the SvREFCNT_dec, only to add it again with hv_name_set */ SvREFCNT_dec(GvHV(gv)); hv_name_set(PL_defstash, "main", 4, 0); - GvHV(gv) = (HV*)SvREFCNT_inc_simple(PL_defstash); + GvHV(gv) = MUTABLE_HV(SvREFCNT_inc_simple(PL_defstash)); SvREADONLY_on(gv); PL_incgv = gv_HVadd(gv_AVadd(gv_fetchpvs("INC", GV_ADD|GV_NOTQUAL, SVt_PVAV))); ==== //depot/perl/pp.c#632 (text) ==== Index: perl/pp.c --- perl/pp.c#631~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/pp.c 2008-10-28 15:14:26.000000000 -0700 @@ -119,7 +119,7 @@ RETURNOP(do_kv()); } else if (gimme == G_SCALAR) { - SV* const sv = Perl_hv_scalar(aTHX_ (HV*)TARG); + SV* const sv = Perl_hv_scalar(aTHX_ MUTABLE_HV(TARG)); SETs(sv); } RETURN; @@ -806,7 +806,7 @@ av_undef((AV*)sv); break; case SVt_PVHV: - hv_undef((HV*)sv); + hv_undef(MUTABLE_HV(sv)); break; case SVt_PVCV: if (cv_const_sv((CV*)sv) && ckWARN(WARN_MISC)) @@ -4011,7 +4011,7 @@ { dVAR; dSP; - HV * hash = (HV*)POPs; + HV * hash = MUTABLE_HV(POPs); HE *entry; const I32 gimme = GIMME_V; @@ -4048,7 +4048,7 @@ if (PL_op->op_private & OPpSLICE) { dMARK; dORIGMARK; - HV * const hv = (HV*)POPs; + HV * const hv = MUTABLE_HV(POPs); const U32 hvtype = SvTYPE(hv); if (hvtype == SVt_PVHV) { /* hash element */ while (++MARK <= SP) { @@ -4079,7 +4079,7 @@ } else { SV *keysv = POPs; - HV * const hv = (HV*)POPs; + HV * const hv = MUTABLE_HV(POPs); SV *sv; if (SvTYPE(hv) == SVt_PVHV) sv = hv_delete_ent(hv, keysv, discard, 0); @@ -4117,7 +4117,7 @@ RETPUSHNO; } tmpsv = POPs; - hv = (HV*)POPs; + hv = MUTABLE_HV(POPs); if (SvTYPE(hv) == SVt_PVHV) { if (hv_exists_ent(hv, tmpsv, 0)) RETPUSHYES; @@ -4137,7 +4137,7 @@ PP(pp_hslice) { dVAR; dSP; dMARK; dORIGMARK; - register HV * const hv = (HV*)POPs; + register HV * const hv = MUTABLE_HV(POPs); register const I32 lval = (PL_op->op_flags & OPf_MOD || LVRET); const bool localizing = PL_op->op_private & OPpLVAL_INTRO; bool other_magic = FALSE; ==== //depot/perl/pp_ctl.c#700 (text) ==== Index: perl/pp_ctl.c --- perl/pp_ctl.c#699~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/pp_ctl.c 2008-10-28 15:14:26.000000000 -0700 @@ -3208,14 +3208,14 @@ I32 first = 0; AV *lav; SV * const req = SvRV(sv); - SV * const pv = *hv_fetchs((HV*)req, "original", FALSE); + SV * const pv = *hv_fetchs(MUTABLE_HV(req), "original", FALSE); /* get the left hand term */ - lav = (AV *)SvRV(*hv_fetchs((HV*)req, "version", FALSE)); + lav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(req), "version", FALSE)); first = SvIV(*av_fetch(lav,0,0)); if ( first > (int)PERL_REVISION /* probably 'use 6.0' */ - || hv_exists((HV*)req, "qv", 2 ) /* qv style */ + || hv_exists(MUTABLE_HV(req), "qv", 2 ) /* qv style */ || av_len(lav) > 1 /* FP with > 3 digits */ || strstr(SvPVX(pv),".0") /* FP with leading 0 */ ) { @@ -3639,7 +3639,7 @@ { dVAR; dSP; - mXPUSHs((SV*)Perl_hv_copy_hints_hv(aTHX_ (HV*)cSVOP_sv)); + mXPUSHs((SV*)Perl_hv_copy_hints_hv(aTHX_ MUTABLE_HV(cSVOP_sv))); RETURN; } @@ -3663,7 +3663,7 @@ const int fakelen = 9 + 1; if (PL_op->op_private & OPpEVAL_HAS_HH) { - saved_hh = (HV*) SvREFCNT_inc(POPs); + saved_hh = MUTABLE_HV(SvREFCNT_inc(POPs)); } sv = POPs; @@ -4108,7 +4108,7 @@ if (SM_OTHER_REF(PVHV)) { /* Check that the key-sets are identical */ HE *he; - HV *other_hv = (HV *) SvRV(Other); + HV *other_hv = MUTABLE_HV(SvRV(Other)); bool tied = FALSE; bool other_tied = FALSE; U32 this_key_count = 0, @@ -4120,27 +4120,27 @@ } else if (SvTIED_mg((SV *) other_hv, PERL_MAGIC_tied)) { HV * const temp = other_hv; - other_hv = (HV *) This; + other_hv = MUTABLE_HV(This); This = (SV *) temp; tied = TRUE; } if (SvTIED_mg((SV *) other_hv, PERL_MAGIC_tied)) other_tied = TRUE; - if (!tied && HvUSEDKEYS((HV *) This) != HvUSEDKEYS(other_hv)) + if (!tied && HvUSEDKEYS((const HV *) This) != HvUSEDKEYS(other_hv)) RETPUSHNO; /* The hashes have the same number of keys, so it suffices to check that one is a subset of the other. */ - (void) hv_iterinit((HV *) This); - while ( (he = hv_iternext((HV *) This)) ) { + (void) hv_iterinit(MUTABLE_HV(This)); + while ( (he = hv_iternext(MUTABLE_HV(This))) ) { I32 key_len; char * const key = hv_iterkey(he, &key_len); ++ this_key_count; if(!hv_exists(other_hv, key, key_len)) { - (void) hv_iterinit((HV *) This); /* reset iterator */ + (void) hv_iterinit(MUTABLE_HV(This)); /* reset iterator */ RETPUSHNO; } } @@ -4170,7 +4170,7 @@ if (svp) { /* ??? When can this not happen? */ key = SvPV(*svp, key_len); - if (hv_exists((HV *) This, key, key_len)) + if (hv_exists(MUTABLE_HV(This), key, key_len)) RETPUSHYES; } } @@ -4180,10 +4180,10 @@ PMOP * const matcher = make_matcher(other_regex); HE *he; - (void) hv_iterinit((HV *) This); - while ( (he = hv_iternext((HV *) This)) ) { + (void) hv_iterinit(MUTABLE_HV(This)); + while ( (he = hv_iternext(MUTABLE_HV(This))) ) { if (matcher_matches_sv(matcher, hv_iterkeysv(he))) { - (void) hv_iterinit((HV *) This); + (void) hv_iterinit(MUTABLE_HV(This)); destroy_matcher(matcher); RETPUSHYES; } @@ -4192,7 +4192,7 @@ RETPUSHNO; } else { - if (hv_exists_ent((HV *) This, Other, 0)) + if (hv_exists_ent(MUTABLE_HV(This), Other, 0)) RETPUSHYES; else RETPUSHNO; ==== //depot/perl/pp_hot.c#580 (text) ==== Index: perl/pp_hot.c --- perl/pp_hot.c#579~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/pp_hot.c 2008-10-28 15:14:26.000000000 -0700 @@ -910,7 +910,7 @@ } else if (gimme == G_SCALAR) { dTARGET; - TARG = Perl_hv_scalar(aTHX_ (HV*)sv); + TARG = Perl_hv_scalar(aTHX_ MUTABLE_HV(sv)); SPAGAIN; SETTARG; } @@ -1039,7 +1039,7 @@ case SVt_PVHV: { /* normal hash */ SV *tmpstr; - hash = (HV*)sv; + hash = MUTABLE_HV(sv); magic = SvMAGICAL(hash) != 0; hv_clear(hash); firsthashrelem = relem; @@ -1769,7 +1769,7 @@ HE* he; SV **svp; SV * const keysv = POPs; - HV * const hv = (HV*)POPs; + HV * const hv = MUTABLE_HV(POPs); const U32 lval = PL_op->op_flags & OPf_MOD || LVRET; const U32 defer = PL_op->op_private & OPpLVAL_DEFER; SV *sv; @@ -3105,7 +3105,7 @@ } } - gv = gv_fetchmethod_flags(stash ? stash : (HV*)packsv, name, + gv = gv_fetchmethod_flags(stash ? stash : MUTABLE_HV(packsv), name, GV_AUTOLOAD | GV_CROAK); assert(gv); ==== //depot/perl/pp_sys.c#563 (text) ==== Index: perl/pp_sys.c --- perl/pp_sys.c#562~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/pp_sys.c 2008-10-28 15:14:26.000000000 -0700 @@ -800,7 +800,7 @@ switch(SvTYPE(varsv)) { case SVt_PVHV: methname = "TIEHASH"; - HvEITER_set((HV *)varsv, 0); + HvEITER_set(MUTABLE_HV(varsv), 0); break; case SVt_PVAV: methname = "TIEARRAY"; @@ -944,7 +944,7 @@ HV* stash; GV *gv; - HV * const hv = (HV*)POPs; + HV * const hv = MUTABLE_HV(POPs); SV * const sv = newSVpvs_flags("AnyDBM_File", SVs_TEMP); stash = gv_stashsv(sv, 0); if (!stash || !(gv = gv_fetchmethod(stash, "TIEHASH"))) { ==== //depot/perl/regcomp.c#663 (text) ==== Index: perl/regcomp.c --- perl/regcomp.c#662~34628~ 2008-10-28 14:59:11.000000000 -0700 +++ perl/regcomp.c 2008-10-28 15:14:26.000000000 -0700 @@ -4839,7 +4839,7 @@ if (RExC_seen & REG_SEEN_CUTGROUP) r->intflags |= PREGf_CUTGROUP_SEEN; if (RExC_paren_names) - RXp_PAREN_NAMES(r) = (HV*)SvREFCNT_inc(RExC_paren_names); + RXp_PAREN_NAMES(r) = MUTABLE_HV(SvREFCNT_inc(RExC_paren_names)); else RXp_PAREN_NAMES(r) = NULL; @@ -9509,7 +9509,7 @@ #define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t)) #define av_dup_inc(s,t) (AV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) -#define hv_dup_inc(s,t) (HV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) +#define hv_dup_inc(s,t) MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)s,t))) #define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL) /* ==== //depot/perl/regexec.c#572 (text) ==== Index: perl/regexec.c --- perl/regexec.c#571~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/regexec.c 2008-10-28 15:14:26.000000000 -0700 @@ -1516,7 +1516,7 @@ = (reg_ac_data*)progi->data->data[ ARG( c ) ]; reg_trie_data *trie = (reg_trie_data*)progi->data->data[ aho->trie ]; - HV *widecharmap = (HV*) progi->data->data[ aho->trie + 1 ]; + HV *widecharmap = MUTABLE_HV(progi->data->data[ aho->trie + 1 ]); const char *last_start = strend - trie->minlen; #ifdef DEBUGGING @@ -2942,7 +2942,7 @@ /* what trie are we using right now */ reg_trie_data * const trie = (reg_trie_data*)rexi->data->data[ ARG( scan ) ]; - HV * widecharmap = (HV *)rexi->data->data[ ARG( scan ) + 1 ]; + HV * widecharmap = MUTABLE_HV(rexi->data->data[ ARG( scan ) + 1 ]); U32 state = trie->startstate; if (trie->bitmap && trie_type != trie_utf8_fold && ==== //depot/perl/scope.c#228 (text) ==== Index: perl/scope.c --- perl/scope.c#227~34585~ 2008-10-25 05:23:01.000000000 -0700 +++ perl/scope.c 2008-10-28 15:14:26.000000000 -0700 @@ -766,7 +766,7 @@ } break; case SAVEt_HV: /* hash reference */ - hv = (HV*)SSPOPPTR; + hv = MUTABLE_HV(SSPOPPTR); gv = (GV*)SSPOPPTR; if (GvHV(gv)) { SvREFCNT_dec(GvHV(gv)); @@ -809,7 +809,7 @@ break; case SAVEt_HPTR: /* HV* reference */ ptr = SSPOPPTR; - *(HV**)ptr = (HV*)SSPOPPTR; + *(HV**)ptr = MUTABLE_HV(SSPOPPTR); break; case SAVEt_APTR: /* AV* reference */ ptr = SSPOPPTR; @@ -875,7 +875,7 @@ av_clear((AV*)sv); break; case SVt_PVHV: - hv_clear((HV*)sv); + hv_clear(MUTABLE_HV(sv)); break; case SVt_PVCV: Perl_croak(aTHX_ "panic: leave_scope pad code"); @@ -900,7 +900,7 @@ break; case SAVEt_DELETE: ptr = SSPOPPTR; - hv = (HV*)ptr; + hv = MUTABLE_HV(ptr); ptr = SSPOPPTR; (void)hv_delete(hv, (char*)ptr, (I32)SSPOPINT, G_DISCARD); SvREFCNT_dec(hv); @@ -944,7 +944,7 @@ case SAVEt_HELEM: /* hash element */ value = (SV*)SSPOPPTR; sv = (SV*)SSPOPPTR; - hv = (HV*)SSPOPPTR; + hv = MUTABLE_HV(SSPOPPTR); ptr = hv_fetch_ent(hv, sv, 1, 0); if (ptr) { const SV * const oval = HeVAL((HE*)ptr); @@ -974,7 +974,7 @@ PL_compiling.cop_hints_hash = (struct refcounted_he *) SSPOPPTR; if (PL_hints & HINT_LOCALIZE_HH) { SvREFCNT_dec((SV*)GvHV(PL_hintgv)); - GvHV(PL_hintgv) = (HV*)SSPOPPTR; + GvHV(PL_hintgv) = MUTABLE_HV(SSPOPPTR); assert(GvHV(PL_hintgv)); } else if (!GvHV(PL_hintgv)) { /* Need to add a new one manually, else gv_fetchpv() can ==== //depot/perl/sv.c#1563 (text) ==== Index: perl/sv.c --- perl/sv.c#1562~34627~ 2008-10-28 14:12:09.000000000 -0700 +++ perl/sv.c 2008-10-28 15:14:26.000000000 -0700 @@ -5067,7 +5067,7 @@ PERL_ARGS_ASSERT_SV_ADD_BACKREF; if (SvTYPE(tsv) == SVt_PVHV) { - AV **const avp = Perl_hv_backreferences_p(aTHX_ (HV*)tsv); + AV **const avp = Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(tsv)); av = *avp; if (!av) { @@ -5123,7 +5123,7 @@ PERL_ARGS_ASSERT_SV_DEL_BACKREF; if (SvTYPE(tsv) == SVt_PVHV && SvOOK(tsv)) { - av = *Perl_hv_backreferences_p(aTHX_ (HV*)tsv); + av = *Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(tsv)); /* We mustn't attempt to "fix up" the hash here by moving the backreference array back to the hv_aux structure, as that is stored in the main HvARRAY(), and hfreentries assumes that no-one @@ -5513,8 +5513,8 @@ if (PL_last_swash_hv == (const HV *)sv) { PL_last_swash_hv = NULL; } - Perl_hv_kill_backrefs(aTHX_ (HV*)sv); - hv_undef((HV*)sv); + Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); + hv_undef(MUTABLE_HV(sv)); break; case SVt_PVAV: if (PL_comppad == (AV*)sv) { @@ -8477,7 +8477,7 @@ if (SvTYPE(tmpRef) != SVt_PVIO) ++PL_sv_objcount; SvUPGRADE(tmpRef, SVt_PVMG); - SvSTASH_set(tmpRef, (HV*)SvREFCNT_inc_simple(stash)); + SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash))); if (Gv_AMG(stash)) SvAMAGIC_on(sv); @@ -9307,7 +9307,7 @@ */ if (sv_derived_from(vecsv, "version")) { char *version = savesvpv(vecsv); - if ( hv_exists((HV*)SvRV(vecsv), "alpha", 5 ) ) { + if ( hv_exists(MUTABLE_HV(SvRV(vecsv)), "alpha", 5 ) ) { Perl_warner(aTHX_ packWARN(WARN_INTERNAL), "vector argument not supported with alpha versions"); goto unknown; @@ -10084,8 +10084,8 @@ #define sv_dup_inc_NN(s,t) SvREFCNT_inc_NN(sv_dup(s,t)) #define av_dup(s,t) (AV*)sv_dup((const SV *)s,t) #define av_dup_inc(s,t) (AV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) -#define hv_dup(s,t) (HV*)sv_dup((const SV *)s,t) -#define hv_dup_inc(s,t) (HV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) +#define hv_dup(s,t) MUTABLE_HV(sv_dup((const SV *)s,t)) +#define hv_dup_inc(s,t) MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)s,t))) #define cv_dup(s,t) (CV*)sv_dup((SV*)s,t) #define cv_dup_inc(s,t) (CV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) #define io_dup(s,t) (IO*)sv_dup((SV*)s,t) @@ -10851,7 +10851,7 @@ } } else - HvARRAY((HV*)dstr) = NULL; + HvARRAY(MUTABLE_HV(dstr)) = NULL; break; case SVt_PVCV: if (!(param->flags & CLONEf_COPY_STACKS)) { @@ -11384,7 +11384,7 @@ { const HEK * const hvname = HvNAME_HEK((const HV *)sv); if (hvname) { - GV* const cloner = gv_fetchmethod_autoload((HV*)sv, "CLONE_SKIP", 0); + GV* const cloner = gv_fetchmethod_autoload(MUTABLE_HV(sv), "CLONE_SKIP", 0); SvFLAGS(sv) |= SVphv_CLONEABLE; /* clone objects by default */ if (cloner && GvCV(cloner)) { dSP; @@ -12128,7 +12128,7 @@ identified by sv_dup() above. */ while(av_len(param->stashes) != -1) { - HV* const stash = (HV*) av_shift(param->stashes); + HV* const stash = MUTABLE_HV(av_shift(param->stashes)); GV* const cloner = gv_fetchmethod_autoload(stash, "CLONE", 0); if (cloner && GvCV(cloner)) { dSP; @@ -12478,7 +12478,7 @@ /* attempt to find a match within the aggregate */ if (hash) { - keysv = find_hash_subscript((HV*)sv, uninit_sv); + keysv = find_hash_subscript((const HV*)sv, uninit_sv); if (keysv) subscript_type = FUV_SUBSCRIPT_HASH; } @@ -12578,7 +12578,7 @@ if (SvMAGICAL(sv)) break; if (obase->op_type == OP_HELEM) { - HE* he = hv_fetch_ent((HV*)sv, cSVOPx_sv(kid), 0, 0); + HE* he = hv_fetch_ent(MUTABLE_HV(sv), cSVOPx_sv(kid), 0, 0); if (!he || HeVAL(he) != uninit_sv) break; } @@ -12599,7 +12599,7 @@ /* index is an expression; * attempt to find a match within the aggregate */ if (obase->op_type == OP_HELEM) { - SV * const keysv = find_hash_subscript((HV*)sv, uninit_sv); + SV * const keysv = find_hash_subscript((const HV*)sv, uninit_sv); if (keysv) return varname(gv, '%', o->op_targ, keysv, 0, FUV_SUBSCRIPT_HASH); End of Patch.