summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doop.c12
-rw-r--r--dump.c5
-rw-r--r--gv.c4
-rw-r--r--hv.c2
-rw-r--r--mathoms.c2
-rw-r--r--mg.c14
-rw-r--r--mro.c18
-rw-r--r--op.c2
-rw-r--r--pad.c2
-rw-r--r--perl.c2
-rw-r--r--pp.c14
-rw-r--r--pp_ctl.c32
-rw-r--r--pp_hot.c8
-rw-r--r--pp_sys.c4
-rw-r--r--regcomp.c4
-rw-r--r--regexec.c4
-rw-r--r--scope.c12
-rw-r--r--sv.c28
18 files changed, 85 insertions, 84 deletions
diff --git a/doop.c b/doop.c
index 84816ec6d5..ffc20a9e3e 100644
--- a/doop.c
+++ b/doop.c
@@ -318,7 +318,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
#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 @@ S_do_trans_count_utf8(pTHX_ SV * const sv)
#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 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
#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 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv)
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 @@ Perl_do_chomp(pTHX_ register SV *sv)
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 @@ Perl_do_kv(pTHX)
{
dVAR;
dSP;
- HV * const hv = (HV*)POPs;
+ HV * const hv = MUTABLE_HV(POPs);
HV *keys;
register HE *entry;
const I32 gimme = GIMME_V;
diff --git a/dump.c b/dump.c
index e59fa21760..7e48ae7772 100644
--- a/dump.c
+++ b/dump.c
@@ -1753,7 +1753,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
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 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
}
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);
diff --git a/gv.c b/gv.c
index 0c8c2a588c..9d3730851b 100644
--- a/gv.c
+++ b/gv.c
@@ -1511,7 +1511,7 @@ Perl_newIO(pTHX)
/* 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 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags)
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;
}
}
diff --git a/hv.c b/hv.c
index 6418576361..746e829c87 100644
--- a/hv.c
+++ b/hv.c
@@ -866,7 +866,7 @@ Perl_hv_scalar(pTHX_ HV *hv)
}
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
diff --git a/mathoms.c b/mathoms.c
index 97614880cc..de032fe546 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -1455,7 +1455,7 @@ Perl_newAV(pTHX)
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;
diff --git a/mg.c b/mg.c
index 643ec7e779..e302e0f430 100644
--- a/mg.c
+++ b/mg.c
@@ -1197,11 +1197,11 @@ Perl_magic_set_all_env(pTHX_ SV *sv, MAGIC *mg)
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 @@ Perl_magic_setamagic(pTHX_ SV *sv, MAGIC *mg)
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_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg)
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 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg)
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 @@ Perl_vivify_defelem(pTHX_ SV *sv)
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)
diff --git a/mro.c b/mro.c
index 57785e9392..97877acfc7 100644
--- a/mro.c
+++ b/mro.c
@@ -88,10 +88,10 @@ Perl_mro_meta_dup(pTHX_ struct mro_meta* smeta, CLONE_PARAMS* param)
= (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 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level)
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 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level)
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 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
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 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
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 @@ Perl_mro_method_changed_in(pTHX_ HV *stash)
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 @@ XS(XS_mro_get_isarev)
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 @@ XS(XS_mro_is_universal)
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)))
diff --git a/op.c b/op.c
index 3048a854b2..15e6522aed 100644
--- a/op.c
+++ b/op.c
@@ -3361,7 +3361,7 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
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)
diff --git a/pad.c b/pad.c
index 9f6e764ced..16a539b1d0 100644
--- a/pad.c
+++ b/pad.c
@@ -367,7 +367,7 @@ Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake
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);
diff --git a/perl.c b/perl.c
index 8d89f3196d..11f21be370 100644
--- a/perl.c
+++ b/perl.c
@@ -3546,7 +3546,7 @@ S_init_main_stash(pTHX)
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)));
diff --git a/pp.c b/pp.c
index 0096c95275..d16b0951af 100644
--- a/pp.c
+++ b/pp.c
@@ -119,7 +119,7 @@ PP(pp_padhv)
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 @@ PP(pp_undef)
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 @@ PP(pp_each)
{
dVAR;
dSP;
- HV * hash = (HV*)POPs;
+ HV * hash = MUTABLE_HV(POPs);
HE *entry;
const I32 gimme = GIMME_V;
@@ -4048,7 +4048,7 @@ PP(pp_delete)
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 @@ PP(pp_delete)
}
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 @@ PP(pp_exists)
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_exists)
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;
diff --git a/pp_ctl.c b/pp_ctl.c
index 8ddb2c4774..c30d485696 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3208,14 +3208,14 @@ PP(pp_require)
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 @@ PP(pp_hintseval)
{
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 @@ PP(pp_entereval)
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 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
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 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
}
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 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
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 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
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 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
RETPUSHNO;
}
else {
- if (hv_exists_ent((HV *) This, Other, 0))
+ if (hv_exists_ent(MUTABLE_HV(This), Other, 0))
RETPUSHYES;
else
RETPUSHNO;
diff --git a/pp_hot.c b/pp_hot.c
index a65e625c8d..44ded8a62f 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -910,7 +910,7 @@ PP(pp_rv2av)
}
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 @@ PP(pp_aassign)
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 @@ PP(pp_helem)
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 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
}
}
- 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);
diff --git a/pp_sys.c b/pp_sys.c
index 96df28d219..7122499b5d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -800,7 +800,7 @@ PP(pp_tie)
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 @@ PP(pp_dbmopen)
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"))) {
diff --git a/regcomp.c b/regcomp.c
index 4645cb3bf7..fa5b8ef734 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4839,7 +4839,7 @@ reStudy:
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 @@ Perl_regfree_internal(pTHX_ REGEXP * const rx)
#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)
/*
diff --git a/regexec.c b/regexec.c
index 068d2e36b4..94bace1e03 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1516,7 +1516,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
= (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 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
/* 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 &&
diff --git a/scope.c b/scope.c
index 9c56266e5f..87a0ee3d9a 100644
--- a/scope.c
+++ b/scope.c
@@ -766,7 +766,7 @@ Perl_leave_scope(pTHX_ I32 base)
}
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 @@ Perl_leave_scope(pTHX_ I32 base)
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 @@ Perl_leave_scope(pTHX_ I32 base)
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 @@ Perl_leave_scope(pTHX_ I32 base)
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 @@ Perl_leave_scope(pTHX_ I32 base)
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 @@ Perl_leave_scope(pTHX_ I32 base)
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
diff --git a/sv.c b/sv.c
index d61ff9f6aa..c38811356e 100644
--- a/sv.c
+++ b/sv.c
@@ -5067,7 +5067,7 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv)
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 @@ S_sv_del_backref(pTHX_ SV *const tsv, SV *const sv)
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 @@ Perl_sv_clear(pTHX_ register SV *const sv)
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 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
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 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
*/
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 @@ ptr_table_* functions.
#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 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
}
}
else
- HvARRAY((HV*)dstr) = NULL;
+ HvARRAY(MUTABLE_HV(dstr)) = NULL;
break;
case SVt_PVCV:
if (!(param->flags & CLONEf_COPY_STACKS)) {
@@ -11384,7 +11384,7 @@ do_mark_cloneable_stash(pTHX_ SV *const sv)
{
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 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
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 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
/* 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 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
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 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
/* 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);