diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-30 23:22:31 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-30 23:22:31 +0000 |
commit | ad64d0ecd555e97c5a216efca1ec5a96b7fd0b34 (patch) | |
tree | f9ac4da2522a36d77b09d165b4cb1d4e43d5b4f4 /gv.c | |
parent | b3dbd76e6e180b608015c6158c3fec9739ef1343 (diff) | |
download | perl-ad64d0ecd555e97c5a216efca1ec5a96b7fd0b34.tar.gz |
Eliminate (SV *) casts from the rest of *.c, picking up one (further)
erroneous const in dump.c.
p4raw-id: //depot/perl@34675
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 53 |
1 files changed, 27 insertions, 26 deletions
@@ -45,7 +45,7 @@ Perl_gv_SVadd(pTHX_ GV *gv) { PERL_ARGS_ASSERT_GV_SVADD; - if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) + if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV) Perl_croak(aTHX_ "Bad symbol for scalar"); if (!GvSV(gv)) GvSV(gv) = newSV(0); @@ -58,7 +58,7 @@ Perl_gv_AVadd(pTHX_ register GV *gv) { PERL_ARGS_ASSERT_GV_AVADD; - if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) + if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV) Perl_croak(aTHX_ "Bad symbol for array"); if (!GvAV(gv)) GvAV(gv) = newAV(); @@ -70,7 +70,7 @@ Perl_gv_HVadd(pTHX_ register GV *gv) { PERL_ARGS_ASSERT_GV_HVADD; - if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) + if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV) Perl_croak(aTHX_ "Bad symbol for hash"); if (!GvHV(gv)) GvHV(gv) = newHV(); @@ -84,7 +84,7 @@ Perl_gv_IOadd(pTHX_ register GV *gv) PERL_ARGS_ASSERT_GV_IOADD; - if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) { + if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV) { /* * if it walks like a dirhandle, then let's assume that @@ -256,7 +256,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) if (old_type < SVt_PVGV) { if (old_type >= SVt_PV) SvCUR_set(gv, 0); - sv_upgrade((SV*)gv, SVt_PVGV); + sv_upgrade(MUTABLE_SV(gv), SVt_PVGV); } if (SvLEN(gv)) { if (proto) { @@ -272,7 +272,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) GvGP(gv) = Perl_newGP(aTHX_ gv); GvSTASH(gv) = stash; if (stash) - Perl_sv_add_backref(aTHX_ (SV*)stash, (SV*)gv); + Perl_sv_add_backref(aTHX_ MUTABLE_SV(stash), MUTABLE_SV(gv)); gv_name_set(gv, name, len, GV_ADD); if (multi || doproto) /* doproto means it _was_ mentioned */ GvMULTI_on(gv); @@ -297,7 +297,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) CvFILE_set_from_cop(GvCV(gv), PL_curcop); CvSTASH(GvCV(gv)) = PL_curstash; if (proto) { - sv_usepvn_flags((SV*)GvCV(gv), proto, protolen, + sv_usepvn_flags(MUTABLE_SV(GvCV(gv)), proto, protolen, SV_HAS_TRAILING_NUL); } } @@ -588,7 +588,7 @@ S_gv_get_super_pkg(pTHX_ const char* name, I32 namelen) gv_init(gv, stash, "ISA", 3, TRUE); superisa = GvAVn(gv); GvMULTI_on(gv); - sv_magic((SV*)superisa, (SV*)gv, PERL_MAGIC_isa, NULL, 0); + sv_magic(MUTABLE_SV(superisa), MUTABLE_SV(gv), PERL_MAGIC_isa, NULL, 0); #ifdef USE_ITHREADS av_push(superisa, newSVpv(CopSTASHPV(PL_curcop), 0)); #else @@ -618,7 +618,7 @@ Perl_gv_fetchmethod_flags(pTHX_ HV *stash, const char *name, U32 flags) GV* gv; HV* ostash = stash; const char * const origname = name; - SV *const error_report = (SV *)stash; + SV *const error_report = MUTABLE_SV(stash); const U32 autoload = flags & GV_AUTOLOAD; const U32 do_croak = flags & GV_CROAK; @@ -739,7 +739,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method) return NULL; if (stash) { if (SvTYPE(stash) < SVt_PVHV) { - packname = SvPV_const((SV*)stash, packname_len); + packname = SvPV_const(MUTABLE_SV(stash), packname_len); stash = NULL; } else { @@ -1204,7 +1204,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (strEQ(name2, "SA")) { AV* const av = GvAVn(gv); GvMULTI_on(gv); - sv_magic((SV*)av, (SV*)gv, PERL_MAGIC_isa, NULL, 0); + sv_magic(MUTABLE_SV(av), MUTABLE_SV(gv), PERL_MAGIC_isa, + NULL, 0); /* NOTE: No support for tied ISA */ if ((add & GV_ADDMULTI) && strEQ(nambeg,"AnyDBM_File::ISA") && AvFILLp(av) == -1) @@ -1342,7 +1343,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, GvMULTI_on(gv); /* If %! has been used, automatically load Errno.pm. */ - sv_magic(GvSVn(gv), (SV*)gv, PERL_MAGIC_sv, name, len); + sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, name, len); /* magicalization must be done before require_tie_mod is called */ if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) @@ -1354,10 +1355,10 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, GvMULTI_on(gv); /* no used once warnings here */ { AV* const av = GvAVn(gv); - SV* const avc = (*name == '+') ? (SV*)av : NULL; + SV* const avc = (*name == '+') ? MUTABLE_SV(av) : NULL; - sv_magic((SV*)av, avc, PERL_MAGIC_regdata, NULL, 0); - sv_magic(GvSVn(gv), (SV*)gv, PERL_MAGIC_sv, name, len); + sv_magic(MUTABLE_SV(av), avc, PERL_MAGIC_regdata, NULL, 0); + sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, name, len); if (avc) SvREADONLY_on(GvSVn(gv)); SvREADONLY_on(av); @@ -1421,7 +1422,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, case '\024': /* $^T */ case '\027': /* $^W */ magicalize: - sv_magic(GvSVn(gv), (SV*)gv, PERL_MAGIC_sv, name, len); + sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, name, len); break; case '\014': /* $^L */ @@ -1646,7 +1647,7 @@ Perl_magic_freeovrld(pTHX_ SV *sv, MAGIC *mg) for (i = 1; i < NofAMmeth; i++) { CV * const cv = amtp->table[i]; if (cv) { - SvREFCNT_dec((SV *) cv); + SvREFCNT_dec(MUTABLE_SV(cv)); amtp->table[i] = NULL; } } @@ -1660,7 +1661,7 @@ bool Perl_Gv_AMupdate(pTHX_ HV *stash) { dVAR; - MAGIC* const mg = mg_find((SV*)stash, PERL_MAGIC_overload_table); + MAGIC* const mg = mg_find((const SV *)stash, PERL_MAGIC_overload_table); AMT amt; const struct mro_meta* stash_meta = HvMROMETA(stash); U32 newgen; @@ -1674,7 +1675,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash) && amtp->was_ok_sub == newgen) { return (bool)AMT_OVERLOADED(amtp); } - sv_unmagic((SV*)stash, PERL_MAGIC_overload_table); + sv_unmagic(MUTABLE_SV(stash), PERL_MAGIC_overload_table); } DEBUG_o( Perl_deb(aTHX_ "Recalcing overload magic in package %s\n",HvNAME_get(stash)) ); @@ -1773,7 +1774,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash) AMT_AMAGIC_on(&amt); if (have_ovl) AMT_OVERLOADED_on(&amt); - sv_magic((SV*)stash, 0, PERL_MAGIC_overload_table, + sv_magic(MUTABLE_SV(stash), 0, PERL_MAGIC_overload_table, (char*)&amt, sizeof(AMT)); return have_ovl; } @@ -1781,7 +1782,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash) /* Here we have no table: */ /* no_table: */ AMT_AMAGIC_off(&amt); - sv_magic((SV*)stash, 0, PERL_MAGIC_overload_table, + sv_magic(MUTABLE_SV(stash), 0, PERL_MAGIC_overload_table, (char*)&amt, sizeof(AMTS)); return FALSE; } @@ -1802,11 +1803,11 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id) stash_meta = HvMROMETA(stash); newgen = PL_sub_generation + stash_meta->pkg_gen + stash_meta->cache_gen; - mg = mg_find((SV*)stash, PERL_MAGIC_overload_table); + mg = mg_find((const SV *)stash, PERL_MAGIC_overload_table); if (!mg) { do_update: Gv_AMupdate(stash); - mg = mg_find((SV*)stash, PERL_MAGIC_overload_table); + mg = mg_find((const SV *)stash, PERL_MAGIC_overload_table); } assert(mg); amtp = (AMT*)mg->mg_ptr; @@ -1853,7 +1854,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) if (!(AMGf_noleft & flags) && SvAMAGIC(left) && (stash = SvSTASH(SvRV(left))) - && (mg = mg_find((SV*)stash, PERL_MAGIC_overload_table)) + && (mg = mg_find((const SV *)stash, PERL_MAGIC_overload_table)) && (ocvp = cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (oamtp = amtp = (AMT*)mg->mg_ptr)->table : NULL)) @@ -1977,7 +1978,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) if (!cv) goto not_found; } else if (!(AMGf_noright & flags) && SvAMAGIC(right) && (stash = SvSTASH(SvRV(right))) - && (mg = mg_find((SV*)stash, PERL_MAGIC_overload_table)) + && (mg = mg_find((const SV *)stash, PERL_MAGIC_overload_table)) && (cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (amtp = (AMT*)mg->mg_ptr)->table : NULL)) @@ -2151,7 +2152,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) PUSHs(newSVpvn_flags(AMG_id2name(method + assignshift), AMG_id2namelen(method + assignshift), SVs_TEMP)); } - PUSHs((SV*)cv); + PUSHs(MUTABLE_SV(cv)); PUTBACK; if ((PL_op = Perl_pp_entersub(aTHX))) |