diff options
-rw-r--r-- | doio.c | 20 | ||||
-rw-r--r-- | dump.c | 8 | ||||
-rw-r--r-- | gv.c | 17 | ||||
-rw-r--r-- | handy.h | 1 | ||||
-rw-r--r-- | mg.c | 10 | ||||
-rw-r--r-- | op.c | 6 | ||||
-rw-r--r-- | perlio.c | 4 | ||||
-rw-r--r-- | pp.c | 25 | ||||
-rw-r--r-- | pp_ctl.c | 12 | ||||
-rw-r--r-- | pp_hot.c | 21 | ||||
-rw-r--r-- | pp_sys.c | 95 | ||||
-rw-r--r-- | scope.c | 10 | ||||
-rw-r--r-- | sv.c | 71 | ||||
-rw-r--r-- | universal.c | 4 | ||||
-rw-r--r-- | util.c | 3 | ||||
-rw-r--r-- | xsutils.c | 4 |
16 files changed, 160 insertions, 151 deletions
@@ -906,7 +906,7 @@ Perl_nextargv(pTHX_ register GV *gv) if (io && (IoFLAGS(io) & IOf_ARGV) && PL_argvout_stack && AvFILLp(PL_argvout_stack) >= 0) { - GV * const oldout = (GV*)av_pop(PL_argvout_stack); + GV * const oldout = MUTABLE_GV(av_pop(PL_argvout_stack)); setdefout(oldout); SvREFCNT_dec(oldout); return NULL; @@ -1308,11 +1308,11 @@ Perl_my_stat(pTHX) STRLEN len; PUTBACK; if (isGV_with_GP(sv)) { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); goto do_fstat; } else if (SvROK(sv) && isGV_with_GP(SvRV(sv))) { - gv = (GV*)SvRV(sv); + gv = MUTABLE_GV(SvRV(sv)); goto do_fstat; } else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVIO) { @@ -1365,7 +1365,7 @@ Perl_my_lstat(pTHX) PUTBACK; if (SvROK(sv) && isGV_with_GP(SvRV(sv)) && ckWARN(WARN_IO)) { Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s", - GvENAME((GV*) SvRV(sv))); + GvENAME((const GV *)SvRV(sv))); return (PL_laststatval = -1); } file = SvPV_nolen_const(sv); @@ -1625,7 +1625,7 @@ Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp) while (++mark <= sp) { GV* gv; if (isGV_with_GP(*mark)) { - gv = (GV*)*mark; + gv = MUTABLE_GV(*mark); do_fchmod: if (GvIO(gv) && IoIFP(GvIOp(gv))) { #ifdef HAS_FCHMOD @@ -1641,7 +1641,7 @@ Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp) } } else if (SvROK(*mark) && isGV_with_GP(SvRV(*mark))) { - gv = (GV*)SvRV(*mark); + gv = MUTABLE_GV(SvRV(*mark)); goto do_fchmod; } else { @@ -1665,7 +1665,7 @@ Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp) while (++mark <= sp) { GV* gv; if (isGV_with_GP(*mark)) { - gv = (GV*)*mark; + gv = MUTABLE_GV(*mark); do_fchown: if (GvIO(gv) && IoIFP(GvIOp(gv))) { #ifdef HAS_FCHOWN @@ -1681,7 +1681,7 @@ Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp) } } else if (SvROK(*mark) && isGV_with_GP(SvRV(*mark))) { - gv = (GV*)SvRV(*mark); + gv = MUTABLE_GV(SvRV(*mark)); goto do_fchown; } else { @@ -1837,7 +1837,7 @@ nothing in the core. while (++mark <= sp) { GV* gv; if (isGV_with_GP(*mark)) { - gv = (GV*)*mark; + gv = MUTABLE_GV(*mark); do_futimes: if (GvIO(gv) && IoIFP(GvIOp(gv))) { #ifdef HAS_FUTIMES @@ -1854,7 +1854,7 @@ nothing in the core. } } else if (SvROK(*mark) && isGV_with_GP(SvRV(*mark))) { - gv = (GV*)SvRV(*mark); + gv = MUTABLE_GV(SvRV(*mark)); goto do_futimes; } else { @@ -110,7 +110,7 @@ Perl_dump_packsubs(pTHX_ const HV *stash) for (i = 0; i <= (I32) HvMAX(stash); i++) { const HE *entry; for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { - const GV * const gv = (GV*)HeVAL(entry); + const GV * const gv = (const GV *)HeVAL(entry); if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv)) continue; if (GvCVu(gv)) @@ -1046,7 +1046,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o) UTF-8 cleanliness of the dump file handle? */ SvUTF8_on(tmpsv); #endif - gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, NULL); + gv_fullname3(tmpsv, MUTABLE_GV(cSVOPo->op_sv), NULL); Perl_dump_indent(aTHX_ level, file, "GV = %s\n", SvPV_nolen_const(tmpsv)); LEAVE; @@ -2168,7 +2168,7 @@ Perl_xmldump_packsubs(pTHX_ const HV *stash) return; for (i = 0; i <= (I32) HvMAX(stash); i++) { for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { - GV *gv = (GV*)HeVAL(entry); + GV *gv = MUTABLE_GV(HeVAL(entry)); HV *hv; if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv)) continue; @@ -2832,7 +2832,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o) ENTER; SAVEFREESV(tmpsv1); SAVEFREESV(tmpsv2); - gv_fullname3(tmpsv1, (GV*)cSVOPo->op_sv, NULL); + gv_fullname3(tmpsv1, MUTABLE_GV(cSVOPo->op_sv), NULL); s = SvPV(tmpsv1,len); sv_catxmlpvn(tmpsv2, s, len, 1); S_xmldump_attr(aTHX_ level, file, "gv=\"%s\"", SvPV(tmpsv2, len)); @@ -669,7 +669,7 @@ Perl_gv_fetchmethod_flags(pTHX_ HV *stash, const char *name, U32 flags) gv = gv_fetchmeth(stash, name, nend - name, 0); if (!gv) { if (strEQ(name,"import") || strEQ(name,"unimport")) - gv = (GV*)&PL_sv_yes; + gv = MUTABLE_GV(&PL_sv_yes); else if (autoload) gv = gv_autoload4(ostash, name, nend - name, TRUE); if (!gv && do_croak) { @@ -996,7 +996,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, tmpbuf[len++] = ':'; gvp = (GV**)hv_fetch(stash,tmpbuf,len,add); gv = gvp ? *gvp : NULL; - if (gv && gv != (GV*)&PL_sv_undef) { + if (gv && gv != (const GV *)&PL_sv_undef) { if (SvTYPE(gv) != SVt_PVGV) gv_init(gv, stash, tmpbuf, len, (add & GV_ADDMULTI)); else @@ -1004,7 +1004,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, } if (tmpbuf != smallbuf) Safefree(tmpbuf); - if (!gv || gv == (GV*)&PL_sv_undef) + if (!gv || gv == (const GV *)&PL_sv_undef) return NULL; if (!(stash = GvHV(gv))) @@ -1019,7 +1019,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, name_cursor++; name = name_cursor; if (name == name_end) - return gv ? gv : (GV*)*hv_fetchs(PL_defstash, "main::", TRUE); + return gv + ? gv : MUTABLE_GV(*hv_fetchs(PL_defstash, "main::", TRUE)); } } len = name_cursor - name; @@ -1080,7 +1081,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, { gvp = (GV**)hv_fetch(stash,name,len,0); if (!gvp || - *gvp == (GV*)&PL_sv_undef || + *gvp == (const GV *)&PL_sv_undef || SvTYPE(*gvp) != SVt_PVGV) { stash = NULL; @@ -1135,7 +1136,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, return NULL; gvp = (GV**)hv_fetch(stash,name,len,add); - if (!gvp || *gvp == (GV*)&PL_sv_undef) + if (!gvp || *gvp == (const GV *)&PL_sv_undef) return NULL; gv = *gvp; if (SvTYPE(gv) == SVt_PVGV) { @@ -1532,14 +1533,14 @@ Perl_gv_check(pTHX_ const HV *stash) register GV *gv; HV *hv; if (HeKEY(entry)[HeKLEN(entry)-1] == ':' && - (gv = (GV*)HeVAL(entry)) && isGV(gv) && (hv = GvHV(gv))) + (gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv))) { if (hv != PL_defstash && hv != stash) gv_check(hv); /* nested package */ } else if (isALPHA(*HeKEY(entry))) { const char *file; - gv = (GV*)HeVAL(entry); + gv = MUTABLE_GV(HeVAL(entry)); if (SvTYPE(gv) != SVt_PVGV || GvMULTI(gv)) continue; file = GvFILE(gv); @@ -56,6 +56,7 @@ Null SV pointer. (No longer available when C<PERL_CORE> is defined.) #define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p)) #define MUTABLE_CV(p) ((CV *)MUTABLE_PTR(p)) +#define MUTABLE_GV(p) ((GV *)MUTABLE_PTR(p)) #define MUTABLE_HV(p) ((HV *)MUTABLE_PTR(p)) #define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p)) #define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p)) @@ -919,7 +919,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) case '5': case '6': case '7': case '8': case '9': case '&': if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { /* - * Pre-threads, this was paren = atoi(GvENAME((GV*)mg->mg_obj)); + * Pre-threads, this was paren = atoi(GvENAME((const GV *)mg->mg_obj)); * XXX Does the new way break anything? */ paren = atoi(mg->mg_ptr); /* $& is in [0] */ @@ -1582,8 +1582,8 @@ Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) calls this same magic */ stash = GvSTASH( SvTYPE(mg->mg_obj) == SVt_PVGV - ? (GV*)mg->mg_obj - : (GV*)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj + ? (const GV *)mg->mg_obj + : (const GV *)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj ); if (stash) @@ -1608,8 +1608,8 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg) /* XXX see comments in magic_setisa */ stash = GvSTASH( SvTYPE(mg->mg_obj) == SVt_PVGV - ? (GV*)mg->mg_obj - : (GV*)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj + ? (const GV *)mg->mg_obj + : (const GV *)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj ); if (stash) @@ -2563,7 +2563,7 @@ Perl_fold_constants(pTHX_ register OP *o) #endif assert(sv); if (type == OP_RV2GV) - newop = newGVOP(OP_GV, 0, (GV*)sv); + newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv)); else newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv)); op_getmad(o,newop,'f'); @@ -4264,7 +4264,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) else if (curop->op_type == OP_PUSHRE) { #ifdef USE_ITHREADS if (((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff) { - GV *const gv = (GV*)PAD_SVl(((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff); + GV *const gv = MUTABLE_GV(PAD_SVl(((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff)); if (gv == PL_defgv || (int)GvASSIGN_GENERATION(gv) == PL_generation) break; @@ -4312,7 +4312,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) cPADOPx(tmpop)->op_padix = 0; /* steal it */ #else pm->op_pmreplrootu.op_pmtargetgv - = (GV*)cSVOPx(tmpop)->op_sv; + = MUTABLE_GV(cSVOPx(tmpop)->op_sv); cSVOPx(tmpop)->op_sv = NULL; /* steal it */ #endif pm->op_pmflags |= PMf_ONCE; @@ -832,7 +832,7 @@ static int perlio_mg_set(pTHX_ SV *sv, MAGIC *mg) { if (SvROK(sv)) { - IO * const io = GvIOn((GV *) SvRV(sv)); + IO * const io = GvIOn(MUTABLE_GV(SvRV(sv))); PerlIO * const ifp = IoIFP(io); PerlIO * const ofp = IoOFP(io); Perl_warn(aTHX_ "set %" SVf " %p %p %p", @@ -845,7 +845,7 @@ static int perlio_mg_get(pTHX_ SV *sv, MAGIC *mg) { if (SvROK(sv)) { - IO * const io = GvIOn((GV *) SvRV(sv)); + IO * const io = GvIOn(MUTABLE_GV(SvRV(sv))); PerlIO * const ifp = IoIFP(io); PerlIO * const ofp = IoOFP(io); Perl_warn(aTHX_ "get %" SVf " %p %p %p", @@ -137,7 +137,7 @@ PP(pp_rv2gv) sv = SvRV(sv); if (SvTYPE(sv) == SVt_PVIO) { - GV * const gv = (GV*) sv_newmortal(); + GV * const gv = MUTABLE_GV(sv_newmortal()); gv_init(gv, 0, "", 0, 0); GvIOp(gv) = MUTABLE_IO(sv); SvREFCNT_inc_void_NN(sv); @@ -165,7 +165,7 @@ PP(pp_rv2gv) STRLEN len; SV * const namesv = PAD_SV(cUNOP->op_targ); const char * const name = SvPV(namesv, len); - gv = (GV*)newSV(0); + gv = MUTABLE_GV(newSV(0)); gv_init(gv, CopSTASH(PL_curcop), name, len, 0); } else { @@ -212,7 +212,7 @@ PP(pp_rv2gv) } } if (PL_op->op_private & OPpLVAL_INTRO) - save_gp((GV*)sv, !(PL_op->op_flags & OPf_SPECIAL)); + save_gp(MUTABLE_GV(sv), !(PL_op->op_flags & OPf_SPECIAL)); SETs(sv); RETURN; } @@ -284,7 +284,7 @@ PP(pp_rv2sv) } } else { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); if (!isGV_with_GP(gv)) { if (SvGMAGICAL(sv)) { @@ -301,7 +301,7 @@ PP(pp_rv2sv) if (PL_op->op_flags & OPf_MOD) { if (PL_op->op_private & OPpLVAL_INTRO) { if (cUNOP->op_first->op_type == OP_NULL) - sv = save_scalar((GV*)TOPs); + sv = save_scalar(MUTABLE_GV(TOPs)); else if (gv) sv = save_scalar(gv); else @@ -589,7 +589,7 @@ PP(pp_gelem) SV *sv = POPs; const char * const elem = SvPV_nolen_const(sv); - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); SV * tmpRef = NULL; sv = NULL; @@ -833,18 +833,19 @@ PP(pp_undef) HV *stash; /* undef *Foo:: */ - if((stash = GvHV((GV*)sv)) && HvNAME_get(stash)) + if((stash = GvHV((const GV *)sv)) && HvNAME_get(stash)) mro_isa_changed_in(stash); /* undef *Pkg::meth_name ... */ - else if(GvCVu((GV*)sv) && (stash = GvSTASH((GV*)sv)) && HvNAME_get(stash)) + else if(GvCVu((const GV *)sv) && (stash = GvSTASH((const GV *)sv)) + && HvNAME_get(stash)) mro_method_changed_in(stash); - gp_free((GV*)sv); + gp_free(MUTABLE_GV(sv)); Newxz(gp, 1, GP); GvGP(sv) = gp_ref(gp); GvSV(sv) = newSV(0); GvLINE(sv) = CopLINE(PL_curcop); - GvEGV(sv) = (GV*)sv; + GvEGV(sv) = MUTABLE_GV(sv); GvMULTI_on(sv); break; } @@ -4178,7 +4179,7 @@ PP(pp_hslice) } if (localizing) { if (HvNAME_get(hv) && isGV(*svp)) - save_gp((GV*)*svp, !(PL_op->op_flags & OPf_SPECIAL)); + save_gp(MUTABLE_GV(*svp), !(PL_op->op_flags & OPf_SPECIAL)); else { if (preeminent) save_helem(hv, keysv, svp); @@ -4704,7 +4705,7 @@ PP(pp_split) #ifdef USE_ITHREADS if (pm->op_pmreplrootu.op_pmtargetoff) { - ary = GvAVn((GV*)PAD_SVl(pm->op_pmreplrootu.op_pmtargetoff)); + ary = GvAVn(MUTABLE_GV(PAD_SVl(pm->op_pmreplrootu.op_pmtargetoff))); } #else if (pm->op_pmreplrootu.op_pmtargetgv) { @@ -1894,7 +1894,7 @@ PP(pp_enteriter) #endif } else { - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); svp = &GvSV(gv); /* symbol table variable */ SAVEGENERICSV(*svp); *svp = newSV(0); @@ -3383,7 +3383,7 @@ PP(pp_require) } if (isGV_with_GP(arg)) { - IO * const io = GvIO((GV *)arg); + IO * const io = GvIO((const GV *)arg); ++filter_has_file; @@ -3601,9 +3601,9 @@ PP(pp_require) if (filter_sub || filter_cache) { SV * const datasv = filter_add(S_run_user_filter, NULL); IoLINES(datasv) = filter_has_file; - IoTOP_GV(datasv) = (GV *)filter_state; - IoBOTTOM_GV(datasv) = (GV *)filter_sub; - IoFMT_GV(datasv) = (GV *)filter_cache; + IoTOP_GV(datasv) = MUTABLE_GV(filter_state); + IoBOTTOM_GV(datasv) = MUTABLE_GV(filter_sub); + IoFMT_GV(datasv) = MUTABLE_GV(filter_cache); } /* switch to eval mode */ @@ -4861,7 +4861,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) SV *cache = MUTABLE_SV(IoFMT_GV(datasv)); if (!cache) { - IoFMT_GV(datasv) = (GV*) (cache = newSV(got_len - umaxlen)); + IoFMT_GV(datasv) = MUTABLE_GV((cache = newSV(got_len - umaxlen))); } else if (SvOK(cache)) { /* Cache should be empty. */ assert(!SvCUR(cache)); @@ -180,7 +180,7 @@ PP(pp_sassign) So change the reference so that it points to the subroutine of that typeglob, as that's what they were after all along. */ - GV *const upgraded = (GV *) cv; + GV *const upgraded = MUTABLE_GV(cv); CV *const source = GvCV(upgraded); assert(source); @@ -306,16 +306,16 @@ PP(pp_readline) { dVAR; tryAMAGICunTARGET(iter, 0); - PL_last_in_gv = (GV*)(*PL_stack_sp--); + PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--); if (!isGV_with_GP(PL_last_in_gv)) { if (SvROK(PL_last_in_gv) && isGV_with_GP(SvRV(PL_last_in_gv))) - PL_last_in_gv = (GV*)SvRV(PL_last_in_gv); + PL_last_in_gv = MUTABLE_GV(SvRV(PL_last_in_gv)); else { dSP; XPUSHs(MUTABLE_SV(PL_last_in_gv)); PUTBACK; pp_rv2gv(); - PL_last_in_gv = (GV*)(*PL_stack_sp--); + PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--); } } return do_readline(); @@ -698,7 +698,8 @@ PP(pp_print) IO *io; register PerlIO *fp; MAGIC *mg; - GV * const gv = (PL_op->op_flags & OPf_STACKED) ? (GV*)*++MARK : PL_defoutgv; + GV * const gv + = (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv; if (gv && (io = GvIO(gv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) @@ -855,7 +856,7 @@ PP(pp_rv2av) RETURN; } else { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); } sv = is_pp_rv2av ? MUTABLE_SV(GvAVn(gv)) : MUTABLE_SV(GvHVn(gv)); if (PL_op->op_private & OPpLVAL_INTRO) @@ -1817,7 +1818,7 @@ PP(pp_helem) } if (PL_op->op_private & OPpLVAL_INTRO) { if (HvNAME_get(hv) && isGV(*svp)) - save_gp((GV*)*svp, !(PL_op->op_flags & OPf_SPECIAL)); + save_gp(MUTABLE_GV(*svp), !(PL_op->op_flags & OPf_SPECIAL)); else { if (!preeminent) { STRLEN keylen; @@ -2668,7 +2669,7 @@ PP(pp_entersub) case SVt_PVGV: if (!isGV_with_GP(sv)) DIE(aTHX_ "Not a CODE reference"); - if (!(cv = GvCVu((GV*)sv))) { + if (!(cv = GvCVu((const GV *)sv))) { HV *stash; cv = sv_2cv(sv, &stash, &gv, 0); } @@ -3079,7 +3080,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (!ob || !(SvOBJECT(ob) || (SvTYPE(ob) == SVt_PVGV && isGV_with_GP(ob) - && (ob = MUTABLE_SV(GvIO((GV*)ob))) + && (ob = MUTABLE_SV(GvIO((const GV *)ob))) && SvOBJECT(ob)))) { Perl_croak(aTHX_ "Can't call method \"%s\" on unblessed reference", @@ -3097,7 +3098,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (hashp) { const HE* const he = hv_fetch_ent(stash, meth, 0, *hashp); if (he) { - gv = (GV*)HeVAL(he); + gv = MUTABLE_GV(HeVAL(he)); if (isGV(gv) && GvCV(gv) && (!GvCVGEN(gv) || GvCVGEN(gv) == (PL_sub_generation + HvMROMETA(stash)->cache_gen))) @@ -385,7 +385,7 @@ PP(pp_glob) #endif /* !VMS */ SAVESPTR(PL_last_in_gv); /* We don't want this to be permanent. */ - PL_last_in_gv = (GV*)*PL_stack_sp--; + PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--); SAVESPTR(PL_rs); /* This is not permanent, either. */ PL_rs = newSVpvs_flags("\000", SVs_TEMP); @@ -519,7 +519,7 @@ PP(pp_open) STRLEN len; bool ok; - GV * const gv = (GV *)*++MARK; + GV * const gv = MUTABLE_GV(*++MARK); if (!isGV(gv)) DIE(aTHX_ PL_no_usym, "filehandle"); @@ -569,7 +569,7 @@ PP(pp_open) PP(pp_close) { dVAR; dSP; - GV * const gv = (MAXARG == 0) ? PL_defoutgv : (GV*)POPs; + GV * const gv = (MAXARG == 0) ? PL_defoutgv : MUTABLE_GV(POPs); if (gv) { IO * const io = GvIO(gv); @@ -601,8 +601,8 @@ PP(pp_pipe_op) register IO *wstio; int fd[2]; - GV * const wgv = (GV*)POPs; - GV * const rgv = (GV*)POPs; + GV * const wgv = MUTABLE_GV(POPs); + GV * const rgv = MUTABLE_GV(POPs); if (!rgv || !wgv) goto badexit; @@ -661,7 +661,7 @@ PP(pp_fileno) if (MAXARG < 1) RETPUSHUNDEF; - gv = (GV*)POPs; + gv = MUTABLE_GV(POPs); if (gv && (io = GvIO(gv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) @@ -734,7 +734,7 @@ PP(pp_binmode) discp = POPs; } - gv = (GV*)POPs; + gv = MUTABLE_GV(POPs); if (gv && (io = GvIO(gv))) { MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); @@ -808,7 +808,7 @@ PP(pp_tie) case SVt_PVGV: if (isGV_with_GP(varsv)) { #ifdef GV_UNIQUE_CHECK - if (GvUNIQUE((GV*)varsv)) { + if (GvUNIQUE((const GV *)varsv)) { Perl_croak(aTHX_ "Attempt to tie unique GV"); } #endif @@ -1168,7 +1168,7 @@ PP(pp_select) { dVAR; dSP; dTARGET; HV *hv; - GV * const newdefout = (PL_op->op_private > 0) ? ((GV *) POPs) : NULL; + GV * const newdefout = (PL_op->op_private > 0) ? (MUTABLE_GV(POPs)) : NULL; GV * egv = GvEGV(PL_defoutgv); if (!egv) @@ -1200,7 +1200,7 @@ PP(pp_getc) { dVAR; dSP; dTARGET; IO *io = NULL; - GV * const gv = (MAXARG==0) ? PL_stdingv : (GV*)POPs; + GV * const gv = (MAXARG==0) ? PL_stdingv : MUTABLE_GV(POPs); if (gv && (io = GvIO(gv))) { MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); @@ -1276,7 +1276,7 @@ PP(pp_enterwrite) if (MAXARG == 0) gv = PL_defoutgv; else { - gv = (GV*)POPs; + gv = MUTABLE_GV(POPs); if (!gv) gv = PL_defoutgv; } @@ -1447,7 +1447,8 @@ PP(pp_prtf) PerlIO *fp; SV *sv; - GV * const gv = (PL_op->op_flags & OPf_STACKED) ? (GV*)*++MARK : PL_defoutgv; + GV * const gv + = (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv; if (gv && (io = GvIO(gv))) { MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); @@ -1519,7 +1520,7 @@ PP(pp_sysopen) const int perm = (MAXARG > 3) ? POPi : 0666; const int mode = POPi; SV * const sv = POPs; - GV * const gv = (GV *)POPs; + GV * const gv = MUTABLE_GV(POPs); STRLEN len; /* Need TIEHANDLE method ? */ @@ -1555,7 +1556,7 @@ PP(pp_sysread) STRLEN charskip = 0; STRLEN skip = 0; - GV * const gv = (GV*)*++MARK; + GV * const gv = MUTABLE_GV(*++MARK); if ((PL_op->op_type == OP_READ || PL_op->op_type == OP_SYSREAD) && gv && (io = GvIO(gv)) ) { @@ -1801,7 +1802,7 @@ PP(pp_send) bool doing_utf8; U8 *tmpbuf = NULL; - GV *const gv = (GV*)*++MARK; + GV *const gv = MUTABLE_GV(*++MARK); if (PL_op->op_type == OP_SYSWRITE && gv && (io = GvIO(gv))) { MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); @@ -2038,7 +2039,7 @@ PP(pp_eof) gv = PL_last_in_gv; /* eof */ } else - gv = PL_last_in_gv = (GV*)POPs; /* eof(FH) */ + gv = PL_last_in_gv = MUTABLE_GV(POPs); /* eof(FH) */ if (gv) { IO * const io = GvIO(gv); @@ -2066,7 +2067,7 @@ PP(pp_tell) IO *io; if (MAXARG != 0) - PL_last_in_gv = (GV*)POPs; + PL_last_in_gv = MUTABLE_GV(POPs); gv = PL_last_in_gv; if (gv && (io = GvIO(gv))) { @@ -2101,7 +2102,7 @@ PP(pp_sysseek) const Off_t offset = (Off_t)SvIVx(POPs); #endif - GV * const gv = PL_last_in_gv = (GV*)POPs; + GV * const gv = PL_last_in_gv = MUTABLE_GV(POPs); IO *io; if (gv && (io = GvIO(gv))) { @@ -2199,11 +2200,11 @@ PP(pp_truncate) const char *name; if (isGV_with_GP(sv)) { - tmpgv = (GV*)sv; /* *main::FRED for example */ + tmpgv = MUTABLE_GV(sv); /* *main::FRED for example */ goto do_ftruncate_gv; } else if (SvROK(sv) && isGV_with_GP(SvRV(sv))) { - tmpgv = (GV*) SvRV(sv); /* \*main::FRED for example */ + tmpgv = MUTABLE_GV(SvRV(sv)); /* \*main::FRED for example */ goto do_ftruncate_gv; } else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVIO) { @@ -2245,7 +2246,7 @@ PP(pp_ioctl) SV * const argsv = POPs; const unsigned int func = POPu; const int optype = PL_op->op_type; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); IO * const io = gv ? GvIOn(gv) : NULL; char *s; IV retval; @@ -2322,7 +2323,7 @@ PP(pp_flock) IO *io = NULL; PerlIO *fp; const int argtype = POPi; - GV * const gv = (MAXARG == 0) ? PL_last_in_gv : (GV*)POPs; + GV * const gv = (MAXARG == 0) ? PL_last_in_gv : MUTABLE_GV(POPs); if (gv && (io = GvIO(gv))) fp = IoIFP(io); @@ -2357,7 +2358,7 @@ PP(pp_socket) const int protocol = POPi; const int type = POPi; const int domain = POPi; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = gv ? GvIOn(gv) : NULL; int fd; @@ -2407,8 +2408,8 @@ PP(pp_sockpair) const int protocol = POPi; const int type = POPi; const int domain = POPi; - GV * const gv2 = (GV*)POPs; - GV * const gv1 = (GV*)POPs; + GV * const gv2 = MUTABLE_GV(POPs); + GV * const gv1 = MUTABLE_GV(POPs); register IO * const io1 = gv1 ? GvIOn(gv1) : NULL; register IO * const io2 = gv2 ? GvIOn(gv2) : NULL; int fd[2]; @@ -2468,7 +2469,7 @@ PP(pp_bind) SV * const addrsv = POPs; /* OK, so on what platform does bind modify addr? */ const char *addr; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); STRLEN len; @@ -2497,7 +2498,7 @@ PP(pp_connect) #ifdef HAS_SOCKET dVAR; dSP; SV * const addrsv = POPs; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); const char *addr; STRLEN len; @@ -2527,7 +2528,7 @@ PP(pp_listen) #ifdef HAS_SOCKET dVAR; dSP; const int backlog = POPi; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = gv ? GvIOn(gv) : NULL; if (!gv || !io || !IoIFP(io)) @@ -2560,8 +2561,8 @@ PP(pp_accept) #else Sock_size_t len = sizeof namebuf; #endif - GV * const ggv = (GV*)POPs; - GV * const ngv = (GV*)POPs; + GV * const ggv = MUTABLE_GV(POPs); + GV * const ngv = MUTABLE_GV(POPs); int fd; if (!ngv) @@ -2632,7 +2633,7 @@ PP(pp_shutdown) #ifdef HAS_SOCKET dVAR; dSP; dTARGET; const int how = POPi; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io || !IoIFP(io)) @@ -2659,7 +2660,7 @@ PP(pp_ssockopt) SV * const sv = (optype == OP_GSOCKOPT) ? sv_2mortal(newSV(257)) : POPs; const unsigned int optname = (unsigned int) POPi; const unsigned int lvl = (unsigned int) POPi; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); int fd; Sock_size_t len; @@ -2733,7 +2734,7 @@ PP(pp_getpeername) #ifdef HAS_SOCKET dVAR; dSP; const int optype = PL_op->op_type; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); Sock_size_t len; SV *sv; @@ -2846,10 +2847,10 @@ PP(pp_stat) else { SV* const sv = POPs; if (isGV_with_GP(sv)) { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); goto do_fstat; } else if(SvROK(sv) && isGV_with_GP(SvRV(sv))) { - gv = (GV*)SvRV(sv); + gv = MUTABLE_GV(SvRV(sv)); if (PL_op->op_type == OP_LSTAT) goto do_fstat_warning_check; goto do_fstat; @@ -3204,9 +3205,9 @@ PP(pp_fttty) if (PL_op->op_flags & OPf_REF) gv = cGVOP_gv; else if (isGV(TOPs)) - gv = (GV*)POPs; + gv = MUTABLE_GV(POPs); else if (SvROK(TOPs) && isGV(SvRV(TOPs))) - gv = (GV*)SvRV(POPs); + gv = MUTABLE_GV(SvRV(POPs)); else gv = gv_fetchsv(tmpsv = POPs, 0, SVt_PVIO); @@ -3253,9 +3254,9 @@ PP(pp_fttext) if (PL_op->op_flags & OPf_REF) gv = cGVOP_gv; else if (isGV(TOPs)) - gv = (GV*)POPs; + gv = MUTABLE_GV(POPs); else if (SvROK(TOPs) && isGV(SvRV(TOPs))) - gv = (GV*)SvRV(POPs); + gv = MUTABLE_GV(SvRV(POPs)); else gv = NULL; @@ -3405,10 +3406,10 @@ PP(pp_chdir) gv = gv_fetchsv(sv, 0, SVt_PVIO); } else if (isGV_with_GP(sv)) { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); } else if (SvROK(sv) && isGV_with_GP(SvRV(sv))) { - gv = (GV*)SvRV(sv); + gv = MUTABLE_GV(SvRV(sv)); } else { tmps = SvPV_nolen_const(sv); @@ -3761,7 +3762,7 @@ PP(pp_open_dir) #if defined(Direntry_t) && defined(HAS_READDIR) dVAR; dSP; const char * const dirname = POPpconstx; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io) @@ -3798,7 +3799,7 @@ PP(pp_readdir) SV *sv; const I32 gimme = GIMME; - GV * const gv = (GV *)POPs; + GV * const gv = MUTABLE_GV(POPs); register const Direntry_t *dp; register IO * const io = GvIOn(gv); @@ -3852,7 +3853,7 @@ PP(pp_telldir) # if !defined(HAS_TELLDIR_PROTO) || defined(NEED_TELLDIR_PROTO) long telldir (DIR *); # endif - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) { @@ -3879,7 +3880,7 @@ PP(pp_seekdir) #if defined(HAS_SEEKDIR) || defined(seekdir) dVAR; dSP; const long along = POPl; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) { @@ -3905,7 +3906,7 @@ PP(pp_rewinddir) { #if defined(HAS_REWINDDIR) || defined(rewinddir) dVAR; dSP; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) { @@ -3930,7 +3931,7 @@ PP(pp_closedir) { #if defined(Direntry_t) && defined(HAS_READDIR) dVAR; dSP; - GV * const gv = (GV*)POPs; + GV * const gv = MUTABLE_GV(POPs); register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) { @@ -710,7 +710,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_SV: /* scalar reference */ value = MUTABLE_SV(SSPOPPTR); - gv = (GV*)SSPOPPTR; + gv = MUTABLE_GV(SSPOPPTR); ptr = &GvSV(gv); av = MUTABLE_AV(gv); /* what to refcnt_dec */ restore_sv: @@ -754,7 +754,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_AV: /* array reference */ av = MUTABLE_AV(SSPOPPTR); - gv = (GV*)SSPOPPTR; + gv = MUTABLE_GV(SSPOPPTR); if (GvAV(gv)) { SvREFCNT_dec(GvAV(gv)); } @@ -767,7 +767,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_HV: /* hash reference */ hv = MUTABLE_HV(SSPOPPTR); - gv = (GV*)SSPOPPTR; + gv = MUTABLE_GV(SSPOPPTR); if (GvHV(gv)) { SvREFCNT_dec(GvHV(gv)); } @@ -817,7 +817,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_GP: /* scalar reference */ ptr = SSPOPPTR; - gv = (GV*)SSPOPPTR; + gv = MUTABLE_GV(SSPOPPTR); gp_free(gv); GvGP(gv) = (GP*)ptr; /* putting a method back into circulation ("local")*/ @@ -1048,7 +1048,7 @@ Perl_leave_scope(pTHX_ I32 base) /* These are only saved in mathoms.c */ case SAVEt_NSTAB: - gv = (GV*)SSPOPPTR; + gv = MUTABLE_GV(SSPOPPTR); (void)sv_clear(MUTABLE_SV(gv)); break; case SAVEt_LONG: /* long reference */ @@ -2264,7 +2264,7 @@ S_sv_2iuv_common(pTHX_ SV *const sv) } else { if (isGV_with_GP(sv)) - return glob_2number((GV *)sv); + return glob_2number(MUTABLE_GV(sv)); if (!(SvFLAGS(sv) & SVs_PADTMP)) { if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) @@ -2635,7 +2635,7 @@ Perl_sv_2nv(pTHX_ register SV *const sv) } else { if (isGV_with_GP(sv)) { - glob_2number((GV *)sv); + glob_2number(MUTABLE_GV(sv)); return 0.0; } @@ -2978,7 +2978,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags } else { if (isGV_with_GP(sv)) - return glob_2pv((GV *)sv, lp); + return glob_2pv(MUTABLE_GV(sv), lp); if (lp) *lp = 0; @@ -3403,17 +3403,17 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype) GvSTASH(dstr) = GvSTASH(sstr); if (GvSTASH(dstr)) Perl_sv_add_backref(aTHX_ MUTABLE_SV(GvSTASH(dstr)), dstr); - gv_name_set((GV *)dstr, name, len, GV_ADD); + gv_name_set(MUTABLE_GV(dstr), name, len, GV_ADD); SvFAKE_on(dstr); /* can coerce to non-glob */ } #ifdef GV_UNIQUE_CHECK - if (GvUNIQUE((GV*)dstr)) { + if (GvUNIQUE((const GV *)dstr)) { Perl_croak(aTHX_ PL_no_modify); } #endif - if(GvGP((GV*)sstr)) { + if(GvGP(MUTABLE_GV(sstr))) { /* If source has method cache entry, clear it */ if(GvCVGEN(sstr)) { SvREFCNT_dec(GvCV(sstr)); @@ -3422,20 +3422,20 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype) } /* If source has a real method, then a method is going to change */ - else if(GvCV((GV*)sstr)) { + else if(GvCV((const GV *)sstr)) { mro_changes = 1; } } /* If dest already had a real method, that's a change as well */ - if(!mro_changes && GvGP((GV*)dstr) && GvCVu((GV*)dstr)) { + if(!mro_changes && GvGP(MUTABLE_GV(dstr)) && GvCVu((const GV *)dstr)) { mro_changes = 1; } - if(strEQ(GvNAME((GV*)dstr),"ISA")) + if(strEQ(GvNAME((const GV *)dstr),"ISA")) mro_changes = 2; - gp_free((GV*)dstr); + gp_free(MUTABLE_GV(dstr)); isGV_with_GP_off(dstr); (void)SvOK_off(dstr); isGV_with_GP_on(dstr); @@ -3467,7 +3467,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) PERL_ARGS_ASSERT_GLOB_ASSIGN_REF; #ifdef GV_UNIQUE_CHECK - if (GvUNIQUE((GV*)dstr)) { + if (GvUNIQUE((const GV *)dstr)) { Perl_croak(aTHX_ PL_no_modify); } #endif @@ -3475,7 +3475,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) if (intro) { GvINTRO_off(dstr); /* one-shot flag */ GvLINE(dstr) = CopLINE(PL_curcop); - GvEGV(dstr) = (GV*)dstr; + GvEGV(dstr) = MUTABLE_GV(dstr); } GvMULTI_on(dstr); switch (stype) { @@ -3516,7 +3516,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) if (stype == SVt_PVCV && (*location != sref || GvCVGEN(dstr))) { CV* const cv = MUTABLE_CV(*location); if (cv) { - if (!GvCVGEN((GV*)dstr) && + if (!GvCVGEN((const GV *)dstr) && (CvROOT(cv) || CvXSUB(cv))) { /* Redefining a sub - warning is mandatory if @@ -3543,12 +3543,12 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) (CvCONST(cv) ? "Constant subroutine %s::%s redefined" : "Subroutine %s::%s redefined"), - HvNAME_get(GvSTASH((GV*)dstr)), - GvENAME((GV*)dstr)); + HvNAME_get(GvSTASH((const GV *)dstr)), + GvENAME(MUTABLE_GV(dstr))); } } if (!intro) - cv_ckproto_len(cv, (GV*)dstr, + cv_ckproto_len(cv, (const GV *)dstr, SvPOK(sref) ? SvPVX_const(sref) : NULL, SvPOK(sref) ? SvCUR(sref) : 0); } @@ -3798,7 +3798,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags) GV *gv = gv_fetchsv(sstr, GV_ADD, SVt_PVGV); if (dstr != (const SV *)gv) { if (GvGP(dstr)) - gp_free((GV*)dstr); + gp_free(MUTABLE_GV(dstr)); GvGP(dstr) = gp_ref(GvGP(gv)); } } @@ -3987,7 +3987,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags) /* FAKE globs can get coerced, so need to turn this off temporarily if it is on. */ SvFAKE_off(sstr); - gv_efullname3(dstr, (GV *)sstr, "*"); + gv_efullname3(dstr, MUTABLE_GV(sstr), "*"); SvFLAGS(sstr) |= wasfake; } else @@ -5539,9 +5539,10 @@ Perl_sv_clear(pTHX_ register SV *const sv) SvREFCNT_dec(LvTARG(sv)); case SVt_PVGV: if (isGV_with_GP(sv)) { - if(GvCVu((GV*)sv) && (stash = GvSTASH((GV*)sv)) && HvNAME_get(stash)) + if(GvCVu((const GV *)sv) && (stash = GvSTASH(MUTABLE_GV(sv))) + && HvNAME_get(stash)) mro_method_changed_in(stash); - gp_free((GV*)sv); + gp_free(MUTABLE_GV(sv)); if (GvNAME_HEK(sv)) unshare_hek(GvNAME_HEK(sv)); /* If we're in a stash, we don't own a reference to it. However it does @@ -5552,7 +5553,7 @@ Perl_sv_clear(pTHX_ register SV *const sv) /* FIXME. There are probably more unreferenced pointers to SVs in the interpreter struct that we should check and tidy in a similar fashion to this: */ - if ((GV*)sv == PL_last_in_gv) + if ((const GV *)sv == PL_last_in_gv) PL_last_in_gv = NULL; case SVt_PVMG: case SVt_PVNV: @@ -7836,7 +7837,7 @@ Perl_sv_reset(pTHX_ register const char *s, HV *const stash) if (!todo[(U8)*HeKEY(entry)]) continue; - gv = (GV*)HeVAL(entry); + gv = MUTABLE_GV(HeVAL(entry)); sv = GvSV(gv); if (sv) { if (SvTHINKFIRST(sv)) { @@ -7897,7 +7898,7 @@ Perl_sv_2io(pTHX_ SV *const sv) break; case SVt_PVGV: if (isGV_with_GP(sv)) { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); io = GvIO(gv); if (!io) Perl_croak(aTHX_ "Bad filehandle: %s", GvNAME(gv)); @@ -7957,7 +7958,7 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **const st, GV **const gvp, const I32 lref) return NULL; case SVt_PVGV: if (isGV_with_GP(sv)) { - gv = (GV*)sv; + gv = MUTABLE_GV(sv); *gvp = gv; *st = GvESTASH(gv); goto fix_gv; @@ -7978,13 +7979,13 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **const st, GV **const gvp, const I32 lref) return cv; } else if(isGV_with_GP(sv)) - gv = (GV*)sv; + gv = MUTABLE_GV(sv); else Perl_croak(aTHX_ "Not a subroutine reference"); } else if (isGV_with_GP(sv)) { SvGETMAGIC(sv); - gv = (GV*)sv; + gv = MUTABLE_GV(sv); } else gv = gv_fetchsv(sv, lref, SVt_PVCV); /* Calls get magic */ @@ -8514,12 +8515,13 @@ S_sv_unglob(pTHX_ SV *const sv) assert(SvTYPE(sv) == SVt_PVGV); SvFAKE_off(sv); - gv_efullname3(temp, (GV *) sv, "*"); + gv_efullname3(temp, MUTABLE_GV(sv), "*"); if (GvGP(sv)) { - if(GvCVu((GV*)sv) && (stash = GvSTASH((GV*)sv)) && HvNAME_get(stash)) + if(GvCVu((const GV *)sv) && (stash = GvSTASH(MUTABLE_GV(sv))) + && HvNAME_get(stash)) mro_method_changed_in(stash); - gp_free((GV*)sv); + gp_free(MUTABLE_GV(sv)); } if (GvSTASH(sv)) { sv_del_backref(MUTABLE_SV(GvSTASH(sv)), sv); @@ -10096,8 +10098,8 @@ ptr_table_* functions. #define cv_dup_inc(s,t) MUTABLE_CV(SvREFCNT_inc(sv_dup((const SV *)s,t))) #define io_dup(s,t) MUTABLE_IO(sv_dup((const SV *)s,t)) #define io_dup_inc(s,t) MUTABLE_IO(SvREFCNT_inc(sv_dup((const SV *)s,t))) -#define gv_dup(s,t) (GV*)sv_dup((const SV *)s,t) -#define gv_dup_inc(s,t) (GV*)SvREFCNT_inc(sv_dup((const SV *)s,t)) +#define gv_dup(s,t) MUTABLE_GV(sv_dup((const SV *)s,t)) +#define gv_dup_inc(s,t) MUTABLE_GV(SvREFCNT_inc(sv_dup((const SV *)s,t))) #define SAVEPV(p) ((p) ? savepv(p) : NULL) #define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL) @@ -10661,7 +10663,7 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) break; case SVt_PVGV: - if (GvUNIQUE((GV*)sstr)) { + if (GvUNIQUE((const GV *)sstr)) { NOOP; /* Do sharing here, and fall through */ } case SVt_PVIO: @@ -10965,7 +10967,8 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param) ncx->blk_loop.oldcomppad); } else { ncx->blk_loop.oldcomppad - = (PAD*)gv_dup((GV*)ncx->blk_loop.oldcomppad, param); + = (PAD*)gv_dup((const GV *)ncx->blk_loop.oldcomppad, + param); } break; case CXt_FORMAT: @@ -11189,7 +11192,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param) gp = (GP*)POPPTR(ss,ix); TOPPTR(nss,ix) = gp = gp_dup(gp, param); (void)GpREFCNT_inc(gp); - gv = (GV*)POPPTR(ss,ix); + gv = (const GV *)POPPTR(ss,ix); TOPPTR(nss,ix) = gv_dup_inc(gv, param); break; case SAVEt_FREEOP: diff --git a/universal.c b/universal.c index 6ba4439990..06dde0ccc2 100644 --- a/universal.c +++ b/universal.c @@ -949,11 +949,11 @@ XS(XS_PerlIO_get_layers) } sv = POPs; - gv = (GV*)sv; + gv = MUTABLE_GV(sv); if (!isGV(sv)) { if (SvROK(sv) && isGV(SvRV(sv))) - gv = (GV*)SvRV(sv); + gv = MUTABLE_GV(SvRV(sv)); else if (SvPOKp(sv)) gv = gv_fetchsv(sv, 0, SVt_PVIO); } @@ -6005,7 +6005,8 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv) if ( svp && ((CvFLAGS(cv) & (CVf_ANON | CVf_CLONED)) || strEQ(GvNAME(gv), "END") || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */ - !( (SvTYPE(*svp) == SVt_PVGV) && (GvCV((GV*)*svp) == cv) )))) { + !( (SvTYPE(*svp) == SVt_PVGV) + && (GvCV((const GV *)*svp) == cv) )))) { /* Use GV from the stack as a fallback. */ /* GV is potentially non-unique, or contain different CV. */ SV * const tmp = newRV(MUTABLE_SV(cv)); @@ -260,8 +260,8 @@ usage: stash = CvSTASH(sv); break; case SVt_PVGV: - if (isGV_with_GP(sv) && GvGP(sv) && GvESTASH((GV*)sv)) - stash = GvESTASH((GV*)sv); + if (isGV_with_GP(sv) && GvGP(sv) && GvESTASH(MUTABLE_GV(sv))) + stash = GvESTASH(MUTABLE_GV(sv)); break; default: break; |