From: Nicholas Clark Date: Wed, 29 Oct 2008 22:45:15 +0000 (+0000) Subject: Eliminate (AV *) casts in *.c. X-Git-Tag: accepted/trunk/20130322.191538~12617 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=502c6561fcd473b7da3277363169d75f16ac2f8b;p=platform%2Fupstream%2Fperl.git Eliminate (AV *) casts in *.c. p4raw-id: //depot/perl@34650 --- diff --git a/av.c b/av.c index a31a8be..0f06ce0 100644 --- a/av.c +++ b/av.c @@ -385,7 +385,7 @@ will have a reference count of 1. AV * Perl_av_make(pTHX_ register I32 size, register SV **strp) { - register AV * const av = (AV*)newSV_type(SVt_PVAV); + register AV * const av = MUTABLE_AV(newSV_type(SVt_PVAV)); /* sv_upgrade does AvREAL_only() */ PERL_ARGS_ASSERT_AV_MAKE; assert(SvTYPE(av) == SVt_PVAV); diff --git a/doop.c b/doop.c index ffc20a9..db97cd5 100644 --- a/doop.c +++ b/doop.c @@ -998,7 +998,7 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv) if (SvTYPE(sv) == SVt_PVAV) { register I32 i; - AV* const av = (AV*)sv; + AV *const av = MUTABLE_AV(sv); const I32 max = AvFILL(av); for (i = 0; i <= max; i++) { @@ -1084,7 +1084,7 @@ Perl_do_chomp(pTHX_ register SV *sv) count = 0; if (SvTYPE(sv) == SVt_PVAV) { register I32 i; - AV* const av = (AV*)sv; + AV *const av = MUTABLE_AV(sv); const I32 max = AvFILL(av); for (i = 0; i <= max; i++) { diff --git a/dump.c b/dump.c index 54d50e6..b2ca93a 100644 --- a/dump.c +++ b/dump.c @@ -1661,10 +1661,10 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo if (AvREIFY(sv)) sv_catpv(d, ",REIFY"); Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX_const(d) + 1 : ""); - if (nest < maxnest && av_len((AV*)sv) >= 0) { + if (nest < maxnest && av_len(MUTABLE_AV(sv)) >= 0) { int count; - for (count = 0; count <= av_len((AV*)sv) && count < maxnest; count++) { - SV** const elt = av_fetch((AV*)sv,count,0); + for (count = 0; count <= av_len(MUTABLE_AV(sv)) && count < maxnest; count++) { + SV** const elt = av_fetch(MUTABLE_AV(sv),count,0); Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", (IV)count); if (elt) @@ -2030,7 +2030,7 @@ Perl_debop(pTHX_ const OP *o) SV *sv; if (cv) { AV * const padlist = CvPADLIST(cv); - AV * const comppad = (AV*)(*av_fetch(padlist, 0, FALSE)); + AV * const comppad = MUTABLE_AV(*av_fetch(padlist, 0, FALSE)); sv = *av_fetch(comppad, o->op_targ, FALSE); } else sv = NULL; diff --git a/mathoms.c b/mathoms.c index de032fe..7cd5e2e 100644 --- a/mathoms.c +++ b/mathoms.c @@ -609,7 +609,7 @@ AV * Perl_av_fake(pTHX_ register I32 size, register SV **strp) { register SV** ary; - register AV * const av = (AV*)newSV_type(SVt_PVAV); + register AV * const av = MUTABLE_AV(newSV_type(SVt_PVAV)); PERL_ARGS_ASSERT_AV_FAKE; @@ -1445,7 +1445,7 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags) AV * Perl_newAV(pTHX) { - return (AV*)newSV_type(SVt_PVAV); + return MUTABLE_AV(newSV_type(SVt_PVAV)); /* sv_upgrade does AvREAL_only(): AvALLOC(av) = 0; AvARRAY(av) = NULL; diff --git a/mg.c b/mg.c index 18f9083..bfd6e2f 100644 --- a/mg.c +++ b/mg.c @@ -358,7 +358,7 @@ Perl_mg_size(pTHX_ SV *sv) switch(SvTYPE(sv)) { case SVt_PVAV: - return AvFILLp((AV *) sv); /* Fallback to non-tied array */ + return AvFILLp((const AV *) sv); /* Fallback to non-tied array */ case SVt_PVHV: /* FIXME */ default: @@ -1603,7 +1603,7 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg) /* Bail out if destruction is going on */ if(PL_dirty) return 0; - av_clear((AV*)sv); + av_clear(MUTABLE_AV(sv)); /* XXX see comments in magic_setisa */ stash = GvSTASH( @@ -1895,7 +1895,7 @@ int Perl_magic_getarylen(pTHX_ SV *sv, const MAGIC *mg) { dVAR; - AV * const obj = (AV*)mg->mg_obj; + AV * const obj = MUTABLE_AV(mg->mg_obj); PERL_ARGS_ASSERT_MAGIC_GETARYLEN; @@ -1911,7 +1911,7 @@ int Perl_magic_setarylen(pTHX_ SV *sv, MAGIC *mg) { dVAR; - AV * const obj = (AV*)mg->mg_obj; + AV * const obj = MUTABLE_AV(mg->mg_obj); PERL_ARGS_ASSERT_MAGIC_SETARYLEN; @@ -2164,7 +2164,7 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg) targ = HeVAL(he); } else { - AV* const av = (AV*)LvTARG(sv); + AV *const av = MUTABLE_AV(LvTARG(sv)); if ((I32)LvTARGOFF(sv) <= AvFILL(av)) targ = AvARRAY(av)[LvTARGOFF(sv)]; } @@ -2218,7 +2218,7 @@ Perl_vivify_defelem(pTHX_ SV *sv) Perl_croak(aTHX_ PL_no_helem_sv, SVfARG(mg->mg_obj)); } else { - AV* const av = (AV*)LvTARG(sv); + AV *const av = MUTABLE_AV(LvTARG(sv)); if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av)) LvTARG(sv) = NULL; /* array can't be extended */ else { @@ -2240,7 +2240,7 @@ int Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg) { PERL_ARGS_ASSERT_MAGIC_KILLBACKREFS; - return Perl_sv_kill_backrefs(aTHX_ sv, (AV*)mg->mg_obj); + return Perl_sv_kill_backrefs(aTHX_ sv, MUTABLE_AV(mg->mg_obj)); } int diff --git a/mro.c b/mro.c index 97877ac..d5b9231 100644 --- a/mro.c +++ b/mro.c @@ -82,10 +82,10 @@ Perl_mro_meta_dup(pTHX_ struct mro_meta* smeta, CLONE_PARAMS* param) if (newmeta->mro_linear_dfs) newmeta->mro_linear_dfs - = (AV*) SvREFCNT_inc(sv_dup((SV*)newmeta->mro_linear_dfs, param)); + = MUTABLE_AV(SvREFCNT_inc(sv_dup((SV*)newmeta->mro_linear_dfs, param))); if (newmeta->mro_linear_c3) newmeta->mro_linear_c3 - = (AV*) SvREFCNT_inc(sv_dup((SV*)newmeta->mro_linear_c3, param)); + = MUTABLE_AV(SvREFCNT_inc(sv_dup((SV*)newmeta->mro_linear_c3, param))); if (newmeta->mro_nextmethod) newmeta->mro_nextmethod = MUTABLE_HV(SvREFCNT_inc(sv_dup((SV*)newmeta->mro_nextmethod, param))); @@ -181,7 +181,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level) /* not in cache, make a new one */ - retval = (AV*)sv_2mortal((SV *)newAV()); + retval = MUTABLE_AV(sv_2mortal((SV *)newAV())); /* We use this later in this function, but don't need a reference to it beyond the end of this function, so reference count is fine. */ our_name = newSVhek(stashhek); @@ -345,7 +345,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level) SV** seqs_ptr; I32 seqs_items; HV* const tails = MUTABLE_HV(sv_2mortal((SV*)newHV())); - AV* const seqs = (AV*)sv_2mortal((SV*)newAV()); + AV *const seqs = MUTABLE_AV(sv_2mortal((SV*)newAV())); I32* heads; /* This builds @seqs, which is an array of arrays. @@ -385,7 +385,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level) seqs_ptr = AvARRAY(seqs); seqs_items = AvFILLp(seqs) + 1; while(seqs_items--) { - AV* const seq = (AV*)*seqs_ptr++; + AV *const seq = MUTABLE_AV(*seqs_ptr++); I32 seq_items = AvFILLp(seq); if(seq_items > 0) { SV** seq_ptr = AvARRAY(seq) + 1; @@ -419,7 +419,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level) SV** const avptr = AvARRAY(seqs); for(s = 0; s <= AvFILLp(seqs); s++) { SV** svp; - AV * const seq = (AV*)(avptr[s]); + AV * const seq = MUTABLE_AV(avptr[s]); SV* seqhead; if(!seq) continue; /* skip empty seqs */ svp = av_fetch(seq, heads[s], 0); diff --git a/pad.c b/pad.c index caf3df5..a68f4d3 100644 --- a/pad.c +++ b/pad.c @@ -210,8 +210,8 @@ Perl_pad_new(pTHX_ int flags) /* ... then update state variables */ - PL_comppad_name = (AV*)(*av_fetch(padlist, 0, FALSE)); - PL_comppad = (AV*)(*av_fetch(padlist, 1, FALSE)); + PL_comppad_name = MUTABLE_AV((*av_fetch(padlist, 0, FALSE))); + PL_comppad = MUTABLE_AV((*av_fetch(padlist, 1, FALSE))); PL_curpad = AvARRAY(PL_comppad); if (! (flags & padnew_CLONE)) { @@ -276,9 +276,9 @@ Perl_pad_undef(pTHX_ CV* cv) if (!PL_dirty) { /* don't bother during global destruction */ CV * const outercv = CvOUTSIDE(cv); const U32 seq = CvOUTSIDE_SEQ(cv); - AV * const comppad_name = (AV*)AvARRAY(padlist)[0]; + AV * const comppad_name = MUTABLE_AV(AvARRAY(padlist)[0]); SV ** const namepad = AvARRAY(comppad_name); - AV * const comppad = (AV*)AvARRAY(padlist)[1]; + AV * const comppad = MUTABLE_AV(AvARRAY(padlist)[1]); SV ** const curpad = AvARRAY(comppad); for (ix = AvFILLp(comppad_name); ix > 0; ix--) { SV * const namesv = namepad[ix]; @@ -629,7 +629,7 @@ Perl_pad_findmy(pTHX_ const char *name) * our $foo = 0 unless defined $foo; * to not give a warning. (Yes, this is a hack) */ - nameav = (AV*)AvARRAY(CvPADLIST(PL_compcv))[0]; + nameav = MUTABLE_AV(AvARRAY(CvPADLIST(PL_compcv))[0]); name_svp = AvARRAY(nameav); for (offset = AvFILLp(nameav); offset > 0; offset--) { const SV * const namesv = name_svp[offset]; @@ -712,7 +712,7 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, if (padlist) { /* not an undef CV */ I32 fake_offset = 0; - const AV * const nameav = (AV*)AvARRAY(padlist)[0]; + const AV * const nameav = MUTABLE_AV(AvARRAY(padlist)[0]); SV * const * const name_svp = AvARRAY(nameav); for (offset = AvFILLp(nameav); offset > 0; offset--) { @@ -810,8 +810,8 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, return offset; } - *out_capture = AvARRAY((AV*)AvARRAY(padlist)[ - CvDEPTH(cv) ? CvDEPTH(cv) : 1])[offset]; + *out_capture = AvARRAY(MUTABLE_AV(AvARRAY(padlist)[ + CvDEPTH(cv) ? CvDEPTH(cv) : 1]))[offset]; DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad findlex cv=0x%"UVxf" found lex=0x%"UVxf"\n", PTR2UV(cv), PTR2UV(*out_capture))); @@ -865,8 +865,8 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, SV *new_namesv; AV * const ocomppad_name = PL_comppad_name; PAD * const ocomppad = PL_comppad; - PL_comppad_name = (AV*)AvARRAY(padlist)[0]; - PL_comppad = (AV*)AvARRAY(padlist)[1]; + PL_comppad_name = MUTABLE_AV(AvARRAY(padlist)[0]); + PL_comppad = MUTABLE_AV(AvARRAY(padlist)[1]); PL_curpad = AvARRAY(PL_comppad); new_offset = pad_add_name( @@ -1345,8 +1345,8 @@ Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padlist, int full) if (!padlist) { return; } - pad_name = (AV*)*av_fetch((AV*)padlist, 0, FALSE); - pad = (AV*)*av_fetch((AV*)padlist, 1, FALSE); + pad_name = MUTABLE_AV(*av_fetch(MUTABLE_AV(padlist), 0, FALSE)); + pad = MUTABLE_AV(*av_fetch(MUTABLE_AV(padlist), 1, FALSE)); pname = AvARRAY(pad_name); ppad = AvARRAY(pad); Perl_dump_indent(aTHX_ level, file, @@ -1455,8 +1455,8 @@ Perl_cv_clone(pTHX_ CV *proto) dVAR; I32 ix; AV* const protopadlist = CvPADLIST(proto); - const AV* const protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE); - const AV* const protopad = (AV*)*av_fetch(protopadlist, 1, FALSE); + const AV *const protopad_name = (const AV *)*av_fetch(protopadlist, 0, FALSE); + const AV *const protopad = (const AV *)*av_fetch(protopadlist, 1, FALSE); SV** const pname = AvARRAY(protopad_name); SV** const ppad = AvARRAY(protopad); const I32 fname = AvFILLp(protopad_name); @@ -1607,8 +1607,8 @@ Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv) { dVAR; I32 ix; - AV * const comppad_name = (AV*)AvARRAY(padlist)[0]; - AV * const comppad = (AV*)AvARRAY(padlist)[1]; + AV * const comppad_name = MUTABLE_AV(AvARRAY(padlist)[0]); + AV * const comppad = MUTABLE_AV(AvARRAY(padlist)[1]); SV ** const namepad = AvARRAY(comppad_name); SV ** const curpad = AvARRAY(comppad); @@ -1650,8 +1650,8 @@ Perl_pad_push(pTHX_ PADLIST *padlist, int depth) SV** const svp = AvARRAY(padlist); AV* const newpad = newAV(); SV** const oldpad = AvARRAY(svp[depth-1]); - I32 ix = AvFILLp((AV*)svp[1]); - const I32 names_fill = AvFILLp((AV*)svp[0]); + I32 ix = AvFILLp((const AV *)svp[1]); + const I32 names_fill = AvFILLp((const AV *)svp[0]); SV** const names = AvARRAY(svp[0]); AV *av; diff --git a/pp.c b/pp.c index 38ba12e..c749cc2 100644 --- a/pp.c +++ b/pp.c @@ -75,23 +75,23 @@ PP(pp_padav) } gimme = GIMME_V; if (gimme == G_ARRAY) { - const I32 maxarg = AvFILL((AV*)TARG) + 1; + const I32 maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; EXTEND(SP, maxarg); if (SvMAGICAL(TARG)) { U32 i; for (i=0; i < (U32)maxarg; i++) { - SV * const * const svp = av_fetch((AV*)TARG, i, FALSE); + SV * const * const svp = av_fetch(MUTABLE_AV(TARG), i, FALSE); SP[i+1] = (svp) ? *svp : &PL_sv_undef; } } else { - Copy(AvARRAY((AV*)TARG), SP+1, maxarg, SV*); + Copy(AvARRAY((const AV *)TARG), SP+1, maxarg, SV*); } SP += maxarg; } else if (gimme == G_SCALAR) { SV* const sv = sv_newmortal(); - const I32 maxarg = AvFILL((AV*)TARG) + 1; + const I32 maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; sv_setiv(sv, maxarg); PUSHs(sv); } @@ -316,8 +316,8 @@ PP(pp_rv2sv) PP(pp_av2arylen) { dVAR; dSP; - AV * const av = (AV*)TOPs; - SV ** const sv = Perl_av_arylen_p(aTHX_ (AV*)av); + AV * const av = MUTABLE_AV(TOPs); + SV ** const sv = Perl_av_arylen_p(aTHX_ MUTABLE_AV(av)); if (!*sv) { *sv = newSV_type(SVt_PVMG); sv_magic(*sv, (SV*)av, PERL_MAGIC_arylen, NULL, 0); @@ -522,8 +522,8 @@ S_refto(pTHX_ SV *sv) SvREFCNT_inc_void_NN(sv); } else if (SvTYPE(sv) == SVt_PVAV) { - if (!AvREAL((AV*)sv) && AvREIFY((AV*)sv)) - av_reify((AV*)sv); + if (!AvREAL((const AV *)sv) && AvREIFY((const AV *)sv)) + av_reify(MUTABLE_AV(sv)); SvTEMP_off(sv); SvREFCNT_inc_void_NN(sv); } @@ -803,7 +803,7 @@ PP(pp_undef) case SVt_NULL: break; case SVt_PVAV: - av_undef((AV*)sv); + av_undef(MUTABLE_AV(sv)); break; case SVt_PVHV: hv_undef(MUTABLE_HV(sv)); @@ -3905,7 +3905,7 @@ PP(pp_quotemeta) PP(pp_aslice) { dVAR; dSP; dMARK; dORIGMARK; - register AV* const av = (AV*)POPs; + register AV *const av = MUTABLE_AV(POPs); register const I32 lval = (PL_op->op_flags & OPf_MOD || LVRET); if (SvTYPE(av) == SVt_PVAV) { @@ -3949,7 +3949,7 @@ PP(pp_aeach) { dVAR; dSP; - AV *array = (AV*)POPs; + AV *array = MUTABLE_AV(POPs); const I32 gimme = GIMME_V; IV *iterp = Perl_av_iter_p(aTHX_ array); const IV current = (*iterp)++; @@ -3975,7 +3975,7 @@ PP(pp_akeys) { dVAR; dSP; - AV *array = (AV*)POPs; + AV *array = MUTABLE_AV(POPs); const I32 gimme = GIMME_V; *Perl_av_iter_p(aTHX_ array) = 0; @@ -4060,7 +4060,7 @@ PP(pp_delete) else if (hvtype == SVt_PVAV) { /* array element */ if (PL_op->op_flags & OPf_SPECIAL) { while (++MARK <= SP) { - SV * const sv = av_delete((AV*)hv, SvIV(*MARK), discard); + SV * const sv = av_delete(MUTABLE_AV(hv), SvIV(*MARK), discard); *MARK = sv ? sv : &PL_sv_undef; } } @@ -4086,7 +4086,7 @@ PP(pp_delete) sv = hv_delete_ent(hv, keysv, discard, 0); else if (SvTYPE(hv) == SVt_PVAV) { if (PL_op->op_flags & OPf_SPECIAL) - sv = av_delete((AV*)hv, SvIV(keysv), discard); + sv = av_delete(MUTABLE_AV(hv), SvIV(keysv), discard); else DIE(aTHX_ "panic: avhv_delete no longer supported"); } @@ -4125,7 +4125,7 @@ PP(pp_exists) } else if (SvTYPE(hv) == SVt_PVAV) { if (PL_op->op_flags & OPf_SPECIAL) { /* array element */ - if (av_exists((AV*)hv, SvIV(tmpsv))) + if (av_exists(MUTABLE_AV(hv), SvIV(tmpsv))) RETPUSHYES; } } @@ -4303,7 +4303,7 @@ PP(pp_anonhash) PP(pp_splice) { dVAR; dSP; dMARK; dORIGMARK; - register AV *ary = (AV*)*++MARK; + register AV *ary = MUTABLE_AV(*++MARK); register SV **src; register SV **dst; register I32 i; @@ -4508,7 +4508,7 @@ PP(pp_splice) PP(pp_push) { dVAR; dSP; dMARK; dORIGMARK; dTARGET; - register AV * const ary = (AV*)*++MARK; + register AV * const ary = MUTABLE_AV(*++MARK); const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied); if (mg) { @@ -4544,7 +4544,7 @@ PP(pp_shift) { dVAR; dSP; - AV * const av = (AV*)POPs; + AV * const av = MUTABLE_AV(POPs); SV * const sv = PL_op->op_type == OP_SHIFT ? av_shift(av) : av_pop(av); EXTEND(SP, 1); assert (sv); @@ -4557,7 +4557,7 @@ PP(pp_shift) PP(pp_unshift) { dVAR; dSP; dMARK; dORIGMARK; dTARGET; - register AV *ary = (AV*)*++MARK; + register AV *ary = MUTABLE_AV(*++MARK); const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied); if (mg) { diff --git a/pp_ctl.c b/pp_ctl.c index 71a35d3..f4364ac 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1976,7 +1976,7 @@ PP(pp_enteriter) } } else /* SvTYPE(maybe_ary) == SVt_PVAV */ { - cx->blk_loop.state_u.ary.ary = (AV*)maybe_ary; + cx->blk_loop.state_u.ary.ary = MUTABLE_AV(maybe_ary); SvREFCNT_inc(maybe_ary); cx->blk_loop.state_u.ary.ix = (PL_op->op_private & OPpITER_REVERSED) ? @@ -2535,10 +2535,10 @@ PP(pp_goto) PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); if (CxHASARGS(cx)) { - AV* const av = (AV*)PAD_SVl(0); + AV *const av = MUTABLE_AV(PAD_SVl(0)); cx->blk_sub.savearray = GvAV(PL_defgv); - GvAV(PL_defgv) = (AV*)SvREFCNT_inc_simple(av); + GvAV(PL_defgv) = MUTABLE_AV(SvREFCNT_inc_simple(av)); CX_CURPAD_SAVE(cx->blk_sub); cx->blk_sub.argarray = av; @@ -2906,7 +2906,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp) (*startop)->op_ppaddr = PL_ppaddr[OP_NULL]; lex_end(); /* XXX DAPM do this properly one year */ - *padp = (AV*)SvREFCNT_inc_simple(PL_comppad); + *padp = MUTABLE_AV(SvREFCNT_inc_simple(PL_comppad)); LEAVE; if (IN_PERL_COMPILETIME) CopHINTS_set(&PL_compiling, PL_hints); @@ -3211,7 +3211,7 @@ PP(pp_require) SV * const pv = *hv_fetchs(MUTABLE_HV(req), "original", FALSE); /* get the left hand term */ - lav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(req), "version", FALSE)); + lav = MUTABLE_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' */ @@ -3334,7 +3334,7 @@ PP(pp_require) if (SvTYPE(SvRV(loader)) == SVt_PVAV && !sv_isobject(loader)) { - loader = *av_fetch((AV *)SvRV(loader), 0, TRUE); + loader = *av_fetch(MUTABLE_AV(SvRV(loader)), 0, TRUE); } Perl_sv_setpvf(aTHX_ namesv, "/loader/0x%"UVxf"/%s", @@ -4159,7 +4159,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) RETPUSHYES; } else if (SM_OTHER_REF(PVAV)) { - AV * const other_av = (AV *) SvRV(Other); + AV * const other_av = MUTABLE_AV(SvRV(Other)); const I32 other_len = av_len(other_av) + 1; I32 i; @@ -4200,8 +4200,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) } else if (SM_REF(PVAV)) { if (SM_OTHER_REF(PVAV)) { - AV *other_av = (AV *) SvRV(Other); - if (av_len((AV *) This) != av_len(other_av)) + AV *other_av = MUTABLE_AV(SvRV(Other)); + if (av_len(MUTABLE_AV(This)) != av_len(other_av)) RETPUSHNO; else { I32 i; @@ -4216,7 +4216,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) (void) sv_2mortal((SV *) seen_other); } for(i = 0; i <= other_len; ++i) { - SV * const * const this_elem = av_fetch((AV *)This, i, FALSE); + SV * const * const this_elem = av_fetch(MUTABLE_AV(This), i, FALSE); SV * const * const other_elem = av_fetch(other_av, i, FALSE); if (!this_elem || !other_elem) { @@ -4252,11 +4252,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) } else if (SM_OTHER_REGEX) { PMOP * const matcher = make_matcher(other_regex); - const I32 this_len = av_len((AV *) This); + const I32 this_len = av_len(MUTABLE_AV(This)); I32 i; for(i = 0; i <= this_len; ++i) { - SV * const * const svp = av_fetch((AV *)This, i, FALSE); + SV * const * const svp = av_fetch(MUTABLE_AV(This), i, FALSE); if (svp && matcher_matches_sv(matcher, *svp)) { destroy_matcher(matcher); RETPUSHYES; @@ -4268,8 +4268,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) else if (SvIOK(Other) || SvNOK(Other)) { I32 i; - for(i = 0; i <= AvFILL((AV *) This); ++i) { - SV * const * const svp = av_fetch((AV *)This, i, FALSE); + for(i = 0; i <= AvFILL(MUTABLE_AV(This)); ++i) { + SV * const * const svp = av_fetch(MUTABLE_AV(This), i, FALSE); if (!svp) continue; @@ -4287,11 +4287,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) RETPUSHNO; } else if (SvPOK(Other)) { - const I32 this_len = av_len((AV *) This); + const I32 this_len = av_len(MUTABLE_AV(This)); I32 i; for(i = 0; i <= this_len; ++i) { - SV * const * const svp = av_fetch((AV *)This, i, FALSE); + SV * const * const svp = av_fetch(MUTABLE_AV(This), i, FALSE); if (!svp) continue; diff --git a/pp_hot.c b/pp_hot.c index d812e95..6ceac4f 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -649,8 +649,8 @@ PP(pp_add) PP(pp_aelemfast) { dVAR; dSP; - AV * const av = PL_op->op_flags & OPf_SPECIAL ? - (AV*)PAD_SV(PL_op->op_targ) : GvAV(cGVOP_gv); + AV * const av = PL_op->op_flags & OPf_SPECIAL + ? MUTABLE_AV(PAD_SV(PL_op->op_targ)) : GvAV(cGVOP_gv); const U32 lval = PL_op->op_flags & OPf_MOD; SV** const svp = av_fetch(av, PL_op->op_private, lval); SV *sv = (svp ? *svp : &PL_sv_undef); @@ -874,7 +874,7 @@ PP(pp_rv2av) } if (is_pp_rv2av) { - AV *const av = (AV*)sv; + AV *const av = MUTABLE_AV(sv); /* The guts of pp_rv2av, with no intenting change to preserve history (until such time as we get tools that can do blame annotation across whitespace changes. */ @@ -1008,7 +1008,7 @@ PP(pp_aassign) sv = *lelem++; switch (SvTYPE(sv)) { case SVt_PVAV: - ary = (AV*)sv; + ary = MUTABLE_AV(sv); magic = SvMAGICAL(ary) != 0; av_clear(ary); av_extend(ary, lastrelem - relem); @@ -2795,7 +2795,7 @@ try_autoload: SAVECOMPPAD(); PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); if (hasargs) { - AV* const av = (AV*)PAD_SVl(0); + AV *const av = MUTABLE_AV(PAD_SVl(0)); if (AvREAL(av)) { /* @_ is normally not REAL--this should only ever * happen when DB::sub() calls things that modify @_ */ @@ -2804,7 +2804,7 @@ try_autoload: AvREIFY_on(av); } cx->blk_sub.savearray = GvAV(PL_defgv); - GvAV(PL_defgv) = (AV*)SvREFCNT_inc_simple(av); + GvAV(PL_defgv) = MUTABLE_AV(SvREFCNT_inc_simple(av)); CX_CURPAD_SAVE(cx->blk_sub); cx->blk_sub.argarray = av; ++MARK; @@ -2904,7 +2904,7 @@ PP(pp_aelem) SV** svp; SV* const elemsv = POPs; IV elem = SvIV(elemsv); - AV* const av = (AV*)POPs; + AV *const av = MUTABLE_AV(POPs); const U32 lval = PL_op->op_flags & OPf_MOD || LVRET; const U32 defer = (PL_op->op_private & OPpLVAL_DEFER) && (elem > av_len(av)); SV *sv; diff --git a/pp_sort.c b/pp_sort.c index d06a953..a239c01 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1553,7 +1553,7 @@ PP(pp_sort) if (priv & OPpSORT_INPLACE) { assert( MARK+1 == SP && *SP && SvTYPE(*SP) == SVt_PVAV); (void)POPMARK; /* remove mark associated with ex-OP_AASSIGN */ - av = (AV*)(*SP); + av = MUTABLE_AV((*SP)); max = AvFILL(av) + 1; if (SvMAGICAL(av)) { MEXTEND(SP, max); @@ -1663,10 +1663,10 @@ PP(pp_sort) if (hasargs) { /* This is mostly copied from pp_entersub */ - AV * const av = (AV*)PAD_SVl(0); + AV * const av = MUTABLE_AV(PAD_SVl(0)); cx->blk_sub.savearray = GvAV(PL_defgv); - GvAV(PL_defgv) = (AV*)SvREFCNT_inc_simple(av); + GvAV(PL_defgv) = MUTABLE_AV(SvREFCNT_inc_simple(av)); CX_CURPAD_SAVE(cx->blk_sub); cx->blk_sub.argarray = av; } diff --git a/regcomp.c b/regcomp.c index fa5b8ef..a751136 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5085,7 +5085,7 @@ Perl_reg_named_buff_scalar(pTHX_ REGEXP * const r, const U32 flags) return newSViv(HvTOTALKEYS(RXp_PAREN_NAMES(rx))); } else if (flags & RXapif_ONE) { ret = CALLREG_NAMED_BUFF_ALL(r, (flags | RXapif_REGNAMES)); - av = (AV*)SvRV(ret); + av = MUTABLE_AV(SvRV(ret)); length = av_len(av); SvREFCNT_dec(ret); return newSViv(length + 1); @@ -9054,13 +9054,13 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) Perl_sv_catpvf(aTHX_ sv, "%d", (int)ARG(o)); /* Parenth number */ if ( RXp_PAREN_NAMES(prog) ) { if ( k != REF || OP(o) < NREF) { - AV *list= (AV *)progi->data->data[progi->name_list_idx]; + AV *list= MUTABLE_AV(progi->data->data[progi->name_list_idx]); SV **name= av_fetch(list, ARG(o), 0 ); if (name) Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", SVfARG(*name)); } else { - AV *list= (AV *)progi->data->data[ progi->name_list_idx ]; + AV *list= MUTABLE_AV(progi->data->data[ progi->name_list_idx ]); SV *sv_dat=(SV*)progi->data->data[ ARG( o ) ]; I32 *nums=(I32*)SvPVX(sv_dat); SV **name= av_fetch(list, nums[0], 0 ); @@ -9433,7 +9433,7 @@ Perl_regfree_internal(pTHX_ REGEXP * const rx) Safefree(ri->data->data[n]); break; case 'p': - new_comppad = (AV*)ri->data->data[n]; + new_comppad = MUTABLE_AV(ri->data->data[n]); break; case 'o': if (new_comppad == NULL) @@ -9508,7 +9508,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 av_dup_inc(s,t) MUTABLE_AV(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) @@ -9945,7 +9945,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, const reg_trie_data * const trie = (reg_trie_data*)ri->data->data[optrie]; #ifdef DEBUGGING - AV *const trie_words = (AV *) ri->data->data[n + TRIE_WORDS_OFFSET]; + AV *const trie_words = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]); #endif const regnode *nextbranch= NULL; I32 word_idx; diff --git a/regexec.c b/regexec.c index 94bace1..008e637 100644 --- a/regexec.c +++ b/regexec.c @@ -3099,7 +3099,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) /* only one choice left - just continue */ DEBUG_EXECUTE_r({ AV *const trie_words - = (AV *) rexi->data->data[ARG(ST.me)+TRIE_WORDS_OFFSET]; + = MUTABLE_AV(rexi->data->data[ARG(ST.me)+TRIE_WORDS_OFFSET]); SV ** const tmp = av_fetch( trie_words, ST.accept_buff[ 0 ].wordnum-1, 0 ); SV *sv= tmp ? sv_newmortal() : NULL; @@ -3181,7 +3181,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) DEBUG_EXECUTE_r({ AV *const trie_words - = (AV *) rexi->data->data[ARG(ST.me)+TRIE_WORDS_OFFSET]; + = MUTABLE_AV(rexi->data->data[ARG(ST.me)+TRIE_WORDS_OFFSET]); SV ** const tmp = av_fetch( trie_words, ST.accept_buff[ best ].wordnum - 1, 0 ); regnode *nextop=(!ST.jump || !ST.jump[ST.accept_buff[best].wordnum]) ? @@ -5686,7 +5686,7 @@ Perl_regclass_swash(pTHX_ const regexp *prog, register const regnode* node, bool if (data->what[n] == 's') { SV * const rv = (SV*)data->data[n]; - AV * const av = (AV*)SvRV((SV*)rv); + AV * const av = MUTABLE_AV(SvRV((SV*)rv)); SV **const ary = AvARRAY(av); SV **a, **b; diff --git a/scope.c b/scope.c index 87a0ee3..d808ac6 100644 --- a/scope.c +++ b/scope.c @@ -712,7 +712,7 @@ Perl_leave_scope(pTHX_ I32 base) value = (SV*)SSPOPPTR; gv = (GV*)SSPOPPTR; ptr = &GvSV(gv); - av = (AV*)gv; /* what to refcnt_dec */ + av = MUTABLE_AV(gv); /* what to refcnt_dec */ restore_sv: sv = *(SV**)ptr; *(SV**)ptr = value; @@ -753,7 +753,7 @@ Perl_leave_scope(pTHX_ I32 base) SvREFCNT_dec(value); break; case SAVEt_AV: /* array reference */ - av = (AV*)SSPOPPTR; + av = MUTABLE_AV(SSPOPPTR); gv = (GV*)SSPOPPTR; if (GvAV(gv)) { SvREFCNT_dec(GvAV(gv)); @@ -813,7 +813,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_APTR: /* AV* reference */ ptr = SSPOPPTR; - *(AV**)ptr = (AV*)SSPOPPTR; + *(AV**)ptr = MUTABLE_AV(SSPOPPTR); break; case SAVEt_GP: /* scalar reference */ ptr = SSPOPPTR; @@ -872,7 +872,7 @@ Perl_leave_scope(pTHX_ I32 base) case SVt_NULL: break; case SVt_PVAV: - av_clear((AV*)sv); + av_clear(MUTABLE_AV(sv)); break; case SVt_PVHV: hv_clear(MUTABLE_HV(sv)); @@ -926,7 +926,7 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_AELEM: /* array element */ value = (SV*)SSPOPPTR; i = SSPOPINT; - av = (AV*)SSPOPPTR; + av = MUTABLE_AV(SSPOPPTR); ptr = av_fetch(av,i,1); if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */ SvREFCNT_dec(value); @@ -953,7 +953,7 @@ Perl_leave_scope(pTHX_ I32 base) if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) SvREFCNT_inc_void(*(SV**)ptr); SvREFCNT_dec(sv); - av = (AV*)hv; /* what to refcnt_dec */ + av = MUTABLE_AV(hv); /* what to refcnt_dec */ goto restore_sv; } } @@ -1022,8 +1022,8 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_SAVESWITCHSTACK: { dSP; - AV* const t = (AV*)SSPOPPTR; - AV* const f = (AV*)SSPOPPTR; + AV *const t = MUTABLE_AV(SSPOPPTR); + AV *const f = MUTABLE_AV(SSPOPPTR); SWITCHSTACK(t,f); PL_curstackinfo->si_stack = f; } diff --git a/sv.c b/sv.c index 575d663..00e22d0 100644 --- a/sv.c +++ b/sv.c @@ -5078,7 +5078,7 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv) if (mg) { /* Aha. They've got it stowed in magic. Bring it back. */ - av = (AV*)mg->mg_obj; + av = MUTABLE_AV(mg->mg_obj); /* Stop mg_free decreasing the refernce count. */ mg->mg_obj = NULL; /* Stop mg_free even calling the destructor, given that @@ -5096,7 +5096,7 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv) const MAGIC *const mg = SvMAGICAL(tsv) ? mg_find(tsv, PERL_MAGIC_backref) : NULL; if (mg) - av = (AV*)mg->mg_obj; + av = MUTABLE_AV(mg->mg_obj); else { av = newAV(); AvREAL_off(av); @@ -5135,7 +5135,7 @@ S_sv_del_backref(pTHX_ SV *const tsv, SV *const sv) const MAGIC *const mg = SvMAGICAL(tsv) ? mg_find(tsv, PERL_MAGIC_backref) : NULL; if (mg) - av = (AV *)mg->mg_obj; + av = MUTABLE_AV(mg->mg_obj); } if (!av) @@ -5519,11 +5519,11 @@ Perl_sv_clear(pTHX_ register SV *const sv) hv_undef(MUTABLE_HV(sv)); break; case SVt_PVAV: - if (PL_comppad == (AV*)sv) { + if (PL_comppad == MUTABLE_AV(sv)) { PL_comppad = NULL; PL_curpad = NULL; } - av_undef((AV*)sv); + av_undef(MUTABLE_AV(sv)); break; case SVt_PVLV: if (LvTYPE(sv) == 'T') { /* for tie: return HE to pool */ @@ -10084,8 +10084,8 @@ ptr_table_* functions. If this changes, please unmerge ss_dup. */ #define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t)) #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 av_dup(s,t) MUTABLE_AV(sv_dup((const SV *)s,t)) +#define av_dup_inc(s,t) MUTABLE_AV(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) MUTABLE_CV(sv_dup((SV*)s,t)) @@ -10324,7 +10324,8 @@ Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *const param) if(mg->mg_type == PERL_MAGIC_backref) { /* The backref AV has its reference count deliberately bumped by 1. */ - nmg->mg_obj = SvREFCNT_inc(av_dup_inc((AV*) mg->mg_obj, param)); + nmg->mg_obj + = SvREFCNT_inc(av_dup_inc((const AV *) mg->mg_obj, param)); } else { nmg->mg_obj = (mg->mg_flags & MGf_REFCOUNTED) @@ -10777,16 +10778,16 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) IoBOTTOM_NAME(dstr) = SAVEPV(IoBOTTOM_NAME(dstr)); break; case SVt_PVAV: - if (AvARRAY((AV*)sstr)) { + if (AvARRAY((const AV *)sstr)) { SV **dst_ary, **src_ary; - SSize_t items = AvFILLp((AV*)sstr) + 1; + SSize_t items = AvFILLp((const AV *)sstr) + 1; - src_ary = AvARRAY((AV*)sstr); - Newxz(dst_ary, AvMAX((AV*)sstr)+1, SV*); + src_ary = AvARRAY((const AV *)sstr); + Newxz(dst_ary, AvMAX((const AV *)sstr)+1, SV*); ptr_table_store(PL_ptr_table, src_ary, dst_ary); - AvARRAY((AV*)dstr) = dst_ary; - AvALLOC((AV*)dstr) = dst_ary; - if (AvREAL((AV*)sstr)) { + AvARRAY(MUTABLE_AV(dstr)) = dst_ary; + AvALLOC((const AV *)dstr) = dst_ary; + if (AvREAL((const AV *)sstr)) { while (items-- > 0) *dst_ary++ = sv_dup_inc(*src_ary++, param); } @@ -10794,14 +10795,14 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) while (items-- > 0) *dst_ary++ = sv_dup(*src_ary++, param); } - items = AvMAX((AV*)sstr) - AvFILLp((AV*)sstr); + items = AvMAX((const AV *)sstr) - AvFILLp((const AV *)sstr); while (items-- > 0) { *dst_ary++ = &PL_sv_undef; } } else { - AvARRAY((AV*)dstr) = NULL; - AvALLOC((AV*)dstr) = (SV**)NULL; + AvARRAY(MUTABLE_AV(dstr)) = NULL; + AvALLOC((const AV *)dstr) = (SV**)NULL; } break; case SVt_PVHV: @@ -10839,8 +10840,8 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) /* backref array needs refcnt=2; see sv_add_backref */ daux->xhv_backreferences = saux->xhv_backreferences - ? (AV*) SvREFCNT_inc( - sv_dup_inc((SV*)saux->xhv_backreferences, param)) + ? MUTABLE_AV(SvREFCNT_inc( + sv_dup_inc((SV*)saux->xhv_backreferences, param))) : 0; daux->xhv_mro_meta = saux->xhv_mro_meta @@ -11254,7 +11255,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param) TOPPTR(nss,ix) = sv_dup_inc(sv, param); i = POPINT(ss,ix); TOPINT(nss,ix) = i; - av = (AV*)POPPTR(ss,ix); + av = (const AV *)POPPTR(ss,ix); TOPPTR(nss,ix) = av_dup_inc(av, param); break; case SAVEt_OP: @@ -12390,7 +12391,7 @@ S_varname(pTHX_ const GV *const gv, const char gvtype, PADOFFSET targ, if (!cv || !CvPADLIST(cv)) return NULL; - av = (AV*)(*av_fetch(CvPADLIST(cv), 0, FALSE)); + av = MUTABLE_AV((*av_fetch(CvPADLIST(cv), 0, FALSE))); sv = *av_fetch(av, targ, FALSE); sv_setpvn(name, SvPV_nolen_const(sv), SvCUR(sv)); } @@ -12485,7 +12486,7 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, subscript_type = FUV_SUBSCRIPT_HASH; } else { - index = find_array_subscript((AV*)sv, uninit_sv); + index = find_array_subscript((const AV *)sv, uninit_sv); if (index >= 0) subscript_type = FUV_SUBSCRIPT_ARRAY; } @@ -12513,7 +12514,7 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, if (obase->op_flags & OPf_SPECIAL) { /* lexical array */ if (match) { SV **svp; - AV *av = (AV*)PAD_SV(obase->op_targ); + AV *av = MUTABLE_AV(PAD_SV(obase->op_targ)); if (!av || SvRMAGICAL(av)) break; svp = av_fetch(av, (I32)obase->op_private, FALSE); @@ -12585,7 +12586,7 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, break; } else { - SV * const * const svp = av_fetch((AV*)sv, SvIV(cSVOPx_sv(kid)), FALSE); + SV * const * const svp = av_fetch(MUTABLE_AV(sv), SvIV(cSVOPx_sv(kid)), FALSE); if (!svp || *svp != uninit_sv) break; } @@ -12607,7 +12608,8 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, keysv, 0, FUV_SUBSCRIPT_HASH); } else { - const I32 index = find_array_subscript((AV*)sv, uninit_sv); + const I32 index + = find_array_subscript((const AV *)sv, uninit_sv); if (index >= 0) return varname(gv, '@', o->op_targ, NULL, index, FUV_SUBSCRIPT_ARRAY); diff --git a/toke.c b/toke.c index 9f1c886..7150bf3 100644 --- a/toke.c +++ b/toke.c @@ -717,7 +717,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, bool new_filter) parser->expect = XSTATE; parser->rsfp = rsfp; parser->rsfp_filters = (new_filter || !oparser) ? newAV() - : (AV*)SvREFCNT_inc(oparser->rsfp_filters); + : MUTABLE_AV(SvREFCNT_inc(oparser->rsfp_filters)); Newx(parser->lex_brackstack, 120, char); Newx(parser->lex_casestack, 12, char); diff --git a/universal.c b/universal.c index 91ff18f..3745ff9 100644 --- a/universal.c +++ b/universal.c @@ -1179,7 +1179,7 @@ XS(XS_re_regnames) if (!ret) XSRETURN_UNDEF; - av = (AV*)SvRV(ret); + av = MUTABLE_AV(SvRV(ret)); length = av_len(av); for (i = 0; i <= length; i++) { diff --git a/util.c b/util.c index 9a3d5fe..a2a4487 100644 --- a/util.c +++ b/util.c @@ -4403,7 +4403,7 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) Compiler in question is: gcc version 3.3 20030304 (Apple Computer, Inc. build 1640) for ( len = 2 - len; len > 0; len-- ) - av_push((AV *)sv, newSViv(0)); + av_push(MUTABLE_AV(sv), newSViv(0)); */ len = 2 - len; while (len-- > 0) @@ -4490,7 +4490,7 @@ Perl_new_version(pTHX_ SV *ver) (void)hv_stores(MUTABLE_HV(hv), "original", newSVsv(pv)); } - sav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(ver), "version", FALSE)); + sav = MUTABLE_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++ ) { @@ -4695,7 +4695,7 @@ Perl_vnumify(pTHX_ SV *vs) /* attempt to retrieve the version array */ - if ( !(av = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE)) ) ) { + if ( !(av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) ) ) { sv_catpvs(sv,"0"); return sv; } @@ -4768,7 +4768,7 @@ Perl_vnormal(pTHX_ SV *vs) if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) alpha = TRUE; - av = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE)); + av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))); len = av_len(av); if ( len == -1 ) @@ -4871,12 +4871,12 @@ Perl_vcmp(pTHX_ SV *lhv, SV *rhv) Perl_croak(aTHX_ "Invalid version object"); /* get the left hand term */ - lav = (AV *)SvRV(*hv_fetchs(MUTABLE_HV(lhv), "version", FALSE)); + lav = MUTABLE_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(MUTABLE_HV(rhv), "version", FALSE)); + rav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(rhv), "version", FALSE))); if ( hv_exists(MUTABLE_HV(rhv), "alpha", 5 ) ) ralpha = TRUE;