diff options
-rw-r--r-- | av.c | 20 | ||||
-rw-r--r-- | cop.h | 2 | ||||
-rw-r--r-- | ext/PerlIO/encoding/encoding.xs | 4 | ||||
-rw-r--r-- | ext/Storable/Storable.xs | 2 | ||||
-rw-r--r-- | gv.c | 4 | ||||
-rw-r--r-- | malloc.c | 2 | ||||
-rw-r--r-- | perl.c | 2 | ||||
-rw-r--r-- | pp.c | 4 | ||||
-rw-r--r-- | pp_ctl.c | 8 | ||||
-rw-r--r-- | pp_hot.c | 8 | ||||
-rw-r--r-- | pp_pack.c | 2 | ||||
-rw-r--r-- | pp_sort.c | 4 | ||||
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | sv.c | 64 |
14 files changed, 66 insertions, 62 deletions
@@ -88,7 +88,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) tmp = AvARRAY(av) - AvALLOC(av); Move(AvARRAY(av), AvALLOC(av), AvFILLp(av)+1, SV*); AvMAX(av) += tmp; - SvPVX(av) = (char*)AvALLOC(av); + SvPV_set(av, (char*)AvALLOC(av)); if (AvREAL(av)) { while (tmp) ary[--tmp] = &PL_sv_undef; @@ -165,7 +165,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) ary[--tmp] = &PL_sv_undef; } - SvPVX(av) = (char*)AvALLOC(av); + SvPV_set(av, (char*)AvALLOC(av)); AvMAX(av) = newmax; } } @@ -361,7 +361,7 @@ Perl_newAV(pTHX) sv_upgrade((SV *)av, SVt_PVAV); AvREAL_on(av); AvALLOC(av) = 0; - SvPVX(av) = 0; + SvPV_set(av, (char*)0); AvMAX(av) = AvFILLp(av) = -1; return av; } @@ -389,7 +389,7 @@ Perl_av_make(pTHX_ register I32 size, register SV **strp) register I32 i; New(4,ary,size,SV*); AvALLOC(av) = ary; - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); AvFILLp(av) = size - 1; AvMAX(av) = size - 1; for (i = 0; i < size; i++) { @@ -414,7 +414,7 @@ Perl_av_fake(pTHX_ register I32 size, register SV **strp) AvALLOC(av) = ary; Copy(strp,ary,size,SV*); AvFLAGS(av) = AVf_REIFY; - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); AvFILLp(av) = size - 1; AvMAX(av) = size - 1; while (size--) { @@ -471,7 +471,7 @@ Perl_av_clear(pTHX_ register AV *av) } if ((key = AvARRAY(av) - AvALLOC(av))) { AvMAX(av) += key; - SvPVX(av) = (char*)AvALLOC(av); + SvPV_set(av, (char*)AvALLOC(av)); } AvFILLp(av) = -1; @@ -505,7 +505,7 @@ Perl_av_undef(pTHX_ register AV *av) } Safefree(AvALLOC(av)); AvALLOC(av) = 0; - SvPVX(av) = 0; + SvPV_set(av, (char*)0); AvMAX(av) = AvFILLp(av) = -1; if (AvARYLEN(av)) { SvREFCNT_dec(AvARYLEN(av)); @@ -644,7 +644,7 @@ Perl_av_unshift(pTHX_ register AV *av, register I32 num) AvMAX(av) += i; AvFILLp(av) += i; - SvPVX(av) = (char*)(AvARRAY(av) - i); + SvPV_set(av, (char*)(AvARRAY(av) - i)); } if (num) { i = AvFILLp(av); @@ -661,7 +661,7 @@ Perl_av_unshift(pTHX_ register AV *av, register I32 num) /* Make extra elements into a buffer */ AvMAX(av) -= slide; AvFILLp(av) -= slide; - SvPVX(av) = (char*)(AvARRAY(av) + slide); + SvPV_set(av, (char*)(AvARRAY(av) + slide)); } } @@ -704,7 +704,7 @@ Perl_av_shift(pTHX_ register AV *av) retval = *AvARRAY(av); if (AvREAL(av)) *AvARRAY(av) = &PL_sv_undef; - SvPVX(av) = (char*)(AvARRAY(av) + 1); + SvPV_set(av, (char*)(AvARRAY(av) + 1)); AvMAX(av)--; AvFILLp(av)--; if (SvSMAGICAL(av)) @@ -168,7 +168,7 @@ struct block_sub { #define CLEAR_ARGARRAY(ary) \ STMT_START { \ AvMAX(ary) += AvARRAY(ary) - AvALLOC(ary); \ - SvPVX(ary) = (char*)AvALLOC(ary); \ + SvPV_set(ary, (char*)AvALLOC(ary)); \ AvFILLp(ary) = -1; \ } STMT_END diff --git a/ext/PerlIO/encoding/encoding.xs b/ext/PerlIO/encoding/encoding.xs index cd692628a1..0bb3fb9b1f 100644 --- a/ext/PerlIO/encoding/encoding.xs +++ b/ext/PerlIO/encoding/encoding.xs @@ -321,7 +321,7 @@ PerlIOEncode_fill(pTHX_ PerlIO * f) use = e->base.bufsiz; } } - SvPVX(e->dataSV) = (char *) ptr; + SvPV_set(e->dataSV, (char *) ptr); SvLEN(e->dataSV) = 0; /* Hands off sv.c - it isn't yours */ SvCUR_set(e->dataSV,use); SvPOK_only(e->dataSV); @@ -462,7 +462,7 @@ PerlIOEncode_flush(pTHX_ PerlIO * f) SAVETMPS; str = sv_newmortal(); sv_upgrade(str, SVt_PV); - SvPVX(str) = (char*)e->base.ptr; + SvPV_set(str, (char*)e->base.ptr); SvLEN(str) = 0; SvCUR_set(str, e->base.end - e->base.ptr); SvPOK_only(str); diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index bba6369661..6bd8343b63 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -5885,7 +5885,7 @@ static SV *do_retrieve( bytes_from_utf8 returned us. */ SvUPGRADE(in, SVt_PV); SvPOK_on(in); - SvPVX(in) = asbytes; + SvPV_set(in, asbytes); SvLEN(in) = klen_tmp; SvCUR(in) = klen_tmp - 1; } @@ -112,7 +112,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) sv_upgrade((SV*)gv, SVt_PVGV); if (SvLEN(gv)) { if (proto) { - SvPVX(gv) = NULL; + SvPV_set(gv, NULL); SvLEN(gv) = 0; SvPOK_off(gv); } else @@ -525,7 +525,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method) * pass along the same data via some unused fields in the CV */ CvSTASH(cv) = stash; - SvPVX(cv) = (char *)name; /* cast to lose constness warning */ + SvPV_set(cv, (char *)name); /* cast to lose constness warning */ SvCUR(cv) = len; return gv; } @@ -1175,7 +1175,7 @@ perl_get_emergency_buffer(IV *size) } SvPOK_off(sv); - SvPVX(sv) = Nullch; + SvPV_set(sv, Nullch); SvCUR(sv) = SvLEN(sv) = 0; *size = malloced_size(pv) + M_OVERHEAD; return pv - sizeof(union overhead); @@ -4550,7 +4550,7 @@ S_init_main_thread(pTHX) SvFLAGS(PL_thrsv) = SVt_PV; SvANY(PL_thrsv) = (void*)xpv; SvREFCNT(PL_thrsv) = 1 << 30; /* practically infinite */ - SvPVX(PL_thrsv) = (char*)thr; + SvPV_set(PL_thrsvr, (char*)thr); SvCUR_set(PL_thrsv, sizeof(thr)); SvLEN_set(PL_thrsv, sizeof(thr)); *SvEND(PL_thrsv) = '\0'; /* in the trailing_nul field */ @@ -4258,7 +4258,7 @@ PP(pp_splice) *dst-- = *src--; } dst = AvARRAY(ary); - SvPVX(ary) = (char*)(AvARRAY(ary) - diff); /* diff is negative */ + SvPV_set(ary, (char*)(AvARRAY(ary) - diff)); /* diff is negative */ AvMAX(ary) += diff; } else { @@ -4295,7 +4295,7 @@ PP(pp_splice) dst = src - diff; Move(src, dst, offset, SV*); } - SvPVX(ary) = (char*)(AvARRAY(ary) - diff);/* diff is positive */ + SvPV_set(ary, (char*)(AvARRAY(ary) - diff));/* diff is positive */ AvMAX(ary) += diff; AvFILLp(ary) += diff; } @@ -244,12 +244,12 @@ PP(pp_substcont) if (SvLEN(targ)) Safefree(SvPVX(targ)); } - SvPVX(targ) = SvPVX(dstr); + SvPV_set(targ, SvPVX(dstr)); SvCUR_set(targ, SvCUR(dstr)); SvLEN_set(targ, SvLEN(dstr)); if (DO_UTF8(dstr)) SvUTF8_on(targ); - SvPVX(dstr) = 0; + SvPV_set(dstr, (char*)0); sv_free(dstr); TAINT_IF(cx->sb_rxtainted & 1); @@ -2394,13 +2394,13 @@ PP(pp_goto) ary = AvALLOC(av); if (AvARRAY(av) != ary) { AvMAX(av) += AvARRAY(av) - AvALLOC(av); - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } if (items >= AvMAX(av) + 1) { AvMAX(av) = items - 1; Renew(ary,items+1,SV*); AvALLOC(av) = ary; - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } } ++mark; @@ -2257,11 +2257,11 @@ PP(pp_subst) if (SvLEN(TARG)) Safefree(SvPVX(TARG)); } - SvPVX(TARG) = SvPVX(dstr); + SvPV_set(TARG, SvPVX(dstr)); SvCUR_set(TARG, SvCUR(dstr)); SvLEN_set(TARG, SvLEN(dstr)); doutf8 |= DO_UTF8(dstr); - SvPVX(dstr) = 0; + SvPV_set(dstr, (char*)0); sv_free(dstr); TAINT_IF(rxtainted & 1); @@ -2723,13 +2723,13 @@ PP(pp_entersub) ary = AvALLOC(av); if (AvARRAY(av) != ary) { AvMAX(av) += AvARRAY(av) - AvALLOC(av); - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } if (items > AvMAX(av) + 1) { AvMAX(av) = items - 1; Renew(ary,items,SV*); AvALLOC(av) = ary; - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } } Copy(MARK,AvARRAY(av),items,SV*); @@ -2452,7 +2452,7 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) { } if (SvLEN(sv) != 0) Safefree(from_start); - SvPVX(sv) = to_start; + SvPV_set(sv, to_start); SvCUR(sv) = to_ptr - to_start; SvLEN(sv) = len; SvUTF8_on(sv); @@ -1748,12 +1748,12 @@ sortcv_stacked(pTHX_ SV *a, SV *b) SV** ary = AvALLOC(av); if (AvARRAY(av) != ary) { AvMAX(av) += AvARRAY(av) - AvALLOC(av); - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } if (AvMAX(av) < 1) { AvMAX(av) = 1; Renew(ary,2,SV*); - SvPVX(av) = (char*)ary; + SvPV_set(av, (char*)ary); } } AvFILLp(av) = 1; @@ -845,7 +845,7 @@ Perl_leave_scope(pTHX_ I32 base) if (SvPVX(gv) && SvLEN(gv) > 0) { Safefree(SvPVX(gv)); } - SvPVX(gv) = (char *)SSPOPPTR; + SvPV_set(gv, (char *)SSPOPPTR); SvCUR(gv) = (STRLEN)SSPOPIV; SvLEN(gv) = (STRLEN)SSPOPIV; gp_free(gv); @@ -1910,13 +1910,13 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PV: SvANY(sv) = new_XPV(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; break; case SVt_PVIV: SvANY(sv) = new_XPVIV(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -1926,7 +1926,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PVNV: SvANY(sv) = new_XPVNV(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -1934,7 +1934,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PVMG: SvANY(sv) = new_XPVMG(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -1944,7 +1944,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PVLV: SvANY(sv) = new_XPVLV(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -1965,7 +1965,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvANY(sv) = new_XPVAV(); if (pv) Safefree(pv); - SvPVX(sv) = 0; + SvPV_set(sv, (char*)0); AvMAX(sv) = -1; AvFILLp(sv) = -1; SvIV_set(sv, 0); @@ -1980,7 +1980,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvANY(sv) = new_XPVHV(); if (pv) Safefree(pv); - SvPVX(sv) = 0; + SvPV_set(sv, (char*)0); HvFILL(sv) = 0; HvMAX(sv) = 0; HvTOTALKEYS(sv) = 0; @@ -1995,7 +1995,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_PVCV: SvANY(sv) = new_XPVCV(); Zero(SvANY(sv), 1, XPVCV); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -2005,7 +2005,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PVGV: SvANY(sv) = new_XPVGV(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -2020,7 +2020,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_PVBM: SvANY(sv) = new_XPVBM(); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -2034,7 +2034,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_PVFM: SvANY(sv) = new_XPVFM(); Zero(SvANY(sv), 1, XPVFM); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -2045,7 +2045,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_PVIO: SvANY(sv) = new_XPVIO(); Zero(SvANY(sv), 1, XPVIO); - SvPVX(sv) = pv; + SvPV_set(sv, pv); SvCUR(sv) = cur; SvLEN(sv) = len; SvIV_set(sv, iv); @@ -2074,7 +2074,7 @@ Perl_sv_backoff(pTHX_ register SV *sv) if (SvIVX(sv)) { char *s = SvPVX(sv); SvLEN(sv) += SvIVX(sv); - SvPVX(sv) -= SvIVX(sv); + SvPV_set(sv, SvPVX(sv) - SvIVX(sv)); SvIV_set(sv, 0); Move(s, SvPVX(sv), SvCUR(sv)+1, char); } @@ -3995,7 +3995,7 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags) (void)SvOOK_off(sv); s = (U8*)SvPVX(sv); len = SvCUR(sv) + 1; /* Plus the \0 */ - SvPVX(sv) = (char*)bytes_to_utf8((U8*)s, &len); + SvPV_set(sv, (char*)bytes_to_utf8((U8*)s, &len)); SvCUR(sv) = len - 1; if (SvLEN(sv) != 0) Safefree(s); /* No longer using what was there before. */ @@ -4906,7 +4906,7 @@ Perl_sv_usepvn(pTHX_ register SV *sv, register char *ptr, register STRLEN len) if (SvPVX(sv) && SvLEN(sv)) Safefree(SvPVX(sv)); Renew(ptr, len+1, char); - SvPVX(sv) = ptr; + SvPV_set(sv, ptr); SvCUR_set(sv, len); SvLEN_set(sv, len+1); *SvEND(sv) = '\0'; @@ -5014,7 +5014,7 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags) SvFAKE_off(sv); SvREADONLY_off(sv); /* This SV doesn't own the buffer, so need to New() a new one: */ - SvPVX(sv) = 0; + SvPV_set(sv, (char*)0); SvLEN(sv) = 0; if (flags & SV_COW_DROP_PV) { /* OK, so we don't need to copy our buffer. */ @@ -5043,7 +5043,7 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags) U32 hash = SvUVX(sv); SvFAKE_off(sv); SvREADONLY_off(sv); - SvPVX(sv) = 0; + SvPV_set(sv, (char*)0); SvLEN(sv) = 0; SvGROW(sv, len + 1); Move(pvx,SvPVX(sv),len,char); @@ -5117,7 +5117,7 @@ Perl_sv_chop(pTHX_ register SV *sv, register char *ptr) SvNIOK_off(sv); SvLEN(sv) -= delta; SvCUR(sv) -= delta; - SvPVX(sv) += delta; + SvPV_set(sv, SvPVX(sv) + delta); SvIV_set(sv, SvIVX(sv) + delta); } @@ -7709,7 +7709,7 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash) PERL_HASH(hash, src, len); new_SV(sv); sv_upgrade(sv, SVt_PVIV); - SvPVX(sv) = sharepvn(src, is_utf8?-len:len, hash); + SvPV_set(sv, sharepvn(src, is_utf8?-len:len, hash)); SvCUR(sv) = len; SvUV_set(sv, hash); SvLEN(sv) = 0; @@ -10675,12 +10675,13 @@ Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) SvRV(dstr) = SvWEAKREF(sstr) ? sv_dup(SvRV(sstr), param) : sv_dup_inc(SvRV(sstr), param); + } else if (SvPVX(sstr)) { /* Has something there */ if (SvLEN(sstr)) { /* Normal PV - clone whole allocated space */ - SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvLEN(sstr)-1); + SvPV_set(dstr, SAVEPVN(SvPVX(sstr), SvLEN(sstr)-1)); if (SvREADONLY(sstr) && SvFAKE(sstr)) { /* Not that normal - actually sstr is copy on write. But we are a true, independant SV, so: */ @@ -10697,25 +10698,28 @@ Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) and they should not have these flags turned off */ - SvPVX(dstr) = sharepvn(SvPVX(sstr), SvCUR(sstr), - SvUVX(sstr)); + SvPV_set(dstr, sharepvn(SvPVX(sstr), SvCUR(sstr), + SvUVX(sstr))); SvUV_set(dstr, SvUVX(sstr)); } else { - SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvCUR(sstr)); + SvPV_set(dstr, SAVEPVN(SvPVX(sstr), SvCUR(sstr))); SvFAKE_off(dstr); SvREADONLY_off(dstr); } } else { /* Some other special case - random pointer */ - SvPVX(dstr) = SvPVX(sstr); + SvPV_set(dstr, SvPVX(sstr)); } } } else { /* Copy the Null */ - SvPVX(dstr) = SvPVX(sstr); + if (SvTYPE(dstr) == SVt_RV) + SvRV(dstr) = 0; + else + SvPV_set(dstr, 0); } } @@ -10938,7 +10942,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) src_ary = AvARRAY((AV*)sstr); Newz(0, dst_ary, AvMAX((AV*)sstr)+1, SV*); ptr_table_store(PL_ptr_table, src_ary, dst_ary); - SvPVX(dstr) = (char*)dst_ary; + SvPV_set(dstr, (char*)dst_ary); AvALLOC((AV*)dstr) = dst_ary; if (AvREAL((AV*)sstr)) { while (items-- > 0) @@ -10954,7 +10958,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) } } else { - SvPVX(dstr) = Nullch; + SvPV_set(dstr, Nullch); AvALLOC((AV*)dstr) = (SV**)NULL; } break; @@ -10983,7 +10987,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) (bool)!!HvSHAREKEYS(sstr), param); } else { - SvPVX(dstr) = Nullch; + SvPV_set(dstr, Nullch); HvEITER((HV*)dstr) = (HE*)NULL; } HvPMROOT((HV*)dstr) = HvPMROOT((HV*)sstr); /* XXX */ @@ -11678,7 +11682,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvREFCNT(&PL_sv_no) = (~(U32)0)/2; SvFLAGS(&PL_sv_no) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; - SvPVX(&PL_sv_no) = SAVEPVN(PL_No, 0); + SvPV_set(&PL_sv_no, SAVEPVN(PL_No, 0)); SvCUR(&PL_sv_no) = 0; SvLEN(&PL_sv_no) = 1; SvIV_set(&PL_sv_no, 0); @@ -11689,7 +11693,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvREFCNT(&PL_sv_yes) = (~(U32)0)/2; SvFLAGS(&PL_sv_yes) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; - SvPVX(&PL_sv_yes) = SAVEPVN(PL_Yes, 1); + SvPV_set(&PL_sv_yes, SAVEPVN(PL_Yes, 1)); SvCUR(&PL_sv_yes) = 1; SvLEN(&PL_sv_yes) = 2; SvIV_set(&PL_sv_yes, 1); |