diff options
36 files changed, 239 insertions, 217 deletions
@@ -229,7 +229,7 @@ Perl_sv_peek(pTHX_ SV *sv) if (SvROK(sv)) { sv_catpv(t, "\\"); if (SvCUR(t) + unref > 10) { - SvCUR(t) = unref + 3; + SvCUR_set(t, unref + 3); *SvEND(t) = '\0'; sv_catpv(t, "..."); goto finish; @@ -1200,8 +1200,10 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo if ((type != SVt_PVHV) && SvUTF8(sv)) sv_catpv(d, "UTF8"); - if (*(SvEND(d) - 1) == ',') - SvPVX(d)[--SvCUR(d)] = '\0'; + if (*(SvEND(d) - 1) == ',') { + SvCUR_set(d, SvCUR(d) - 1); + SvPVX(d)[SvCUR(d)] = '\0'; + } sv_catpv(d, ")"); s = SvPVX(d); diff --git a/ext/ByteLoader/ByteLoader.pm b/ext/ByteLoader/ByteLoader.pm index cf9fdf2874..5ff3c91370 100644 --- a/ext/ByteLoader/ByteLoader.pm +++ b/ext/ByteLoader/ByteLoader.pm @@ -2,7 +2,7 @@ package ByteLoader; use XSLoader (); -our $VERSION = '0.05'; +our $VERSION = '0.06'; XSLoader::load 'ByteLoader', $VERSION; @@ -15,7 +15,7 @@ ByteLoader - load byte compiled perl code =head1 SYNOPSIS - use ByteLoader 0.04; + use ByteLoader 0.06; <byte code> or just diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c index d2f424273f..fd506b1430 100644 --- a/ext/ByteLoader/byterun.c +++ b/ext/ByteLoader/byterun.c @@ -216,7 +216,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) { svindex arg; BGET_svindex(arg); - SvRV(bstate->bs_sv) = arg; + SvRV_set(bstate->bs_sv, arg); break; } case INSN_XPV: /* 22 */ @@ -224,18 +224,18 @@ byterun(pTHX_ register struct byteloader_state *bstate) BSET_xpv(bstate->bs_sv); break; } - case INSN_XPV_CUR: /* 23 */ + case INSN_XPV_CUR: /* 23 */ { STRLEN arg; BGET_PADOFFSET(arg); - SvCUR(bstate->bs_sv) = arg; + SvCUR_set(bstate->bs_sv, arg); break; } case INSN_XPV_LEN: /* 24 */ { STRLEN arg; BGET_PADOFFSET(arg); - SvLEN(bstate->bs_sv) = arg; + SvLEN_set(bstate->bs_sv, arg); break; } case INSN_XIV: /* 25 */ diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm index 1639189b3d..0a91414509 100644 --- a/ext/Data/Dumper/Dumper.pm +++ b/ext/Data/Dumper/Dumper.pm @@ -9,7 +9,7 @@ package Data::Dumper; -$VERSION = '2.121_04'; +$VERSION = '2.121_05'; #$| = 1; diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index 5d983656ea..0626977e00 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -215,7 +215,7 @@ sv_x(pTHX_ SV *sv, register char *str, STRLEN len, I32 n) SvGROW(sv, len*n + SvCUR(sv) + 1); if (len == 1) { char *start = SvPVX(sv) + SvCUR(sv); - SvCUR(sv) += n; + SvCUR_set(sv, SvCUR(sv) + n); start[n] = '\0'; while (n > 0) start[--n] = str[0]; @@ -855,7 +855,7 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv, av_push(postav, postentry); e = newRV_inc(e); - SvCUR(newapad) = 0; + SvCUR_set(newapad, 0); if (indent >= 2) (void)sv_x(aTHX_ newapad, " ", 1, SvCUR(postentry)); diff --git a/ext/Devel/Peek/Peek.pm b/ext/Devel/Peek/Peek.pm index 4559a0d801..bf19c27d7a 100644 --- a/ext/Devel/Peek/Peek.pm +++ b/ext/Devel/Peek/Peek.pm @@ -3,7 +3,7 @@ package Devel::Peek; -$VERSION = '1.02'; +$VERSION = '1.03'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Devel/Peek/Peek.xs b/ext/Devel/Peek/Peek.xs index 4d01a2b618..13fce6ae4e 100644 --- a/ext/Devel/Peek/Peek.xs +++ b/ext/Devel/Peek/Peek.xs @@ -240,7 +240,7 @@ _mstats_to_hv(HV *hv, struct mstats_buffer *b, int level) if (!SvOK(*svp)) { av = newAV(); (void)SvUPGRADE(*svp, SVt_RV); - SvRV(*svp) = (SV*)av; + SvRV_set(*svp, (SV*)av); SvROK_on(*svp); } else av = (AV*)SvRV(*svp); diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 49813d59c5..9ac98f9acf 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -4,7 +4,7 @@ package Encode; use strict; # our $VERSION = do { my @r = (q$Revision: 2.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; -our $VERSION = '2.0902'; +our $VERSION = '2.0902_01'; sub DEBUG () { 0 } use XSLoader (); XSLoader::load(__PACKAGE__, $VERSION); diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index de7028c3c1..2f907b6e64 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -524,7 +524,7 @@ CODE: } sv_catsv(dst, encode_method(aTHX_ enc, enc->t_utf8, src, check, &offset, term, &code)); - SvIVX(off) = (IV)offset; + SvIV_set(off, (IV)offset); if (code == ENCODE_FOUND_TERM) { ST(0) = &PL_sv_yes; }else{ diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm index 5c3da9fa81..a9f8b46b1c 100644 --- a/ext/List/Util/lib/List/Util.pm +++ b/ext/List/Util/lib/List/Util.pm @@ -10,7 +10,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle); -$VERSION = "1.14"; +$VERSION = "1.14_01"; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index 78d733a808..87676215e7 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -2,7 +2,7 @@ package POSIX; our(@ISA, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD) = (); -our $VERSION = "1.08"; +our $VERSION = "1.09"; use AutoLoader; diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 4703dcf005..561dc3053c 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1476,7 +1476,7 @@ read(fd, buffer, nbytes) char * buffer = sv_grow( sv_buffer, nbytes+1 ); CLEANUP: if (RETVAL >= 0) { - SvCUR(sv_buffer) = RETVAL; + SvCUR_set(sv_buffer, RETVAL); SvPOK_only(sv_buffer); *SvEND(sv_buffer) = '\0'; SvTAINTED_on(sv_buffer); @@ -1652,7 +1652,7 @@ strxfrm(src) strxfrm(SvPVX(ST(0)), p, (size_t)dstlen); dstlen--; } - SvCUR(ST(0)) = dstlen; + SvCUR_set(ST(0), dstlen); SvPOK_only(ST(0)); } diff --git a/ext/PerlIO/encoding/encoding.pm b/ext/PerlIO/encoding/encoding.pm index 61a116f205..3eb7dd589f 100644 --- a/ext/PerlIO/encoding/encoding.pm +++ b/ext/PerlIO/encoding/encoding.pm @@ -1,6 +1,6 @@ package PerlIO::encoding; use strict; -our $VERSION = '0.07'; +our $VERSION = '0.08'; our $DEBUG = 0; $DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n"; diff --git a/ext/PerlIO/encoding/encoding.xs b/ext/PerlIO/encoding/encoding.xs index 0bb3fb9b1f..e743f3f11b 100644 --- a/ext/PerlIO/encoding/encoding.xs +++ b/ext/PerlIO/encoding/encoding.xs @@ -322,7 +322,7 @@ PerlIOEncode_fill(pTHX_ PerlIO * f) } } SvPV_set(e->dataSV, (char *) ptr); - SvLEN(e->dataSV) = 0; /* Hands off sv.c - it isn't yours */ + SvLEN_set(e->dataSV, 0); /* Hands off sv.c - it isn't yours */ SvCUR_set(e->dataSV,use); SvPOK_only(e->dataSV); } @@ -463,7 +463,7 @@ PerlIOEncode_flush(pTHX_ PerlIO * f) str = sv_newmortal(); sv_upgrade(str, SVt_PV); SvPV_set(str, (char*)e->base.ptr); - SvLEN(str) = 0; + SvLEN_set(str, 0); SvCUR_set(str, e->base.end - e->base.ptr); SvPOK_only(str); SvUTF8_on(str); diff --git a/ext/PerlIO/scalar/scalar.pm b/ext/PerlIO/scalar/scalar.pm index 1c4fa4549c..7eb936eacb 100644 --- a/ext/PerlIO/scalar/scalar.pm +++ b/ext/PerlIO/scalar/scalar.pm @@ -1,5 +1,5 @@ package PerlIO::scalar; -our $VERSION = '0.02'; +our $VERSION = '0.03'; use XSLoader (); XSLoader::load 'PerlIO::scalar'; 1; diff --git a/ext/PerlIO/scalar/scalar.xs b/ext/PerlIO/scalar/scalar.xs index c116f07f17..074da92631 100644 --- a/ext/PerlIO/scalar/scalar.xs +++ b/ext/PerlIO/scalar/scalar.xs @@ -40,7 +40,7 @@ PerlIOScalar_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, SvUPGRADE(s->var, SVt_PV); code = PerlIOBase_pushed(aTHX_ f, mode, Nullsv, tab); if (!SvOK(s->var) || (PerlIOBase(f)->flags) & PERLIO_F_TRUNCATE) - SvCUR(s->var) = 0; + SvCUR_set(s->var, 0); if ((PerlIOBase(f)->flags) & PERLIO_F_APPEND) s->posn = SvCUR(s->var); else diff --git a/ext/Storable/Storable.pm b/ext/Storable/Storable.pm index bdfaa19735..2c7e307dad 100644 --- a/ext/Storable/Storable.pm +++ b/ext/Storable/Storable.pm @@ -21,7 +21,7 @@ package Storable; @ISA = qw(Exporter DynaLoader); use AutoLoader; use vars qw($canonical $forgive_me $VERSION); -$VERSION = '2.14'; +$VERSION = '2.15'; *AUTOLOAD = \&AutoLoader::AUTOLOAD; # Grrr... # diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 6bd8343b63..702644e5f6 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -973,7 +973,7 @@ static const char byteorderstr_56[] = {BYTEORDER_BYTES_56, 0}; stash = gv_stashpv((p), TRUE); \ ref = newRV_noinc(s); \ (void) sv_bless(ref, stash); \ - SvRV(ref) = 0; \ + SvRV_set(ref, NULL); \ SvREFCNT_dec(ref); \ } STMT_END /* @@ -2849,7 +2849,7 @@ static int store_hook( ref = newRV_noinc(sv); /* Temporary reference */ av = array_call(aTHX_ ref, hook, clone); /* @a = $object->STORABLE_freeze($c) */ - SvRV(ref) = 0; + SvRV_set(ref, NULL); SvREFCNT_dec(ref); /* Reclaim temporary reference */ count = AvFILLp(av) + 1; @@ -4303,7 +4303,7 @@ static SV *retrieve_ref(pTHX_ stcxt_t *cxt, char *cname) sv_upgrade(rv, SVt_RV); } - SvRV(rv) = sv; /* $rv = \$sv */ + SvRV_set(rv, sv); /* $rv = \$sv */ SvROK_on(rv); TRACEME(("ok (retrieve_ref at 0x%"UVxf")", PTR2UV(rv))); @@ -4363,7 +4363,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, char *cname) */ sv_upgrade(rv, SVt_RV); - SvRV(rv) = sv; /* $rv = \$sv */ + SvRV_set(rv, sv); /* $rv = \$sv */ SvROK_on(rv); /* @@ -5886,8 +5886,8 @@ static SV *do_retrieve( SvUPGRADE(in, SVt_PV); SvPOK_on(in); SvPV_set(in, asbytes); - SvLEN(in) = klen_tmp; - SvCUR(in) = klen_tmp - 1; + SvLEN_set(in, klen_tmp); + SvCUR_set(in, klen_tmp - 1); } } #endif diff --git a/ext/threads/shared/shared.pm b/ext/threads/shared/shared.pm index dd6a705813..0a4bd04f8d 100644 --- a/ext/threads/shared/shared.pm +++ b/ext/threads/shared/shared.pm @@ -7,7 +7,7 @@ BEGIN { require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(share cond_wait cond_timedwait cond_broadcast cond_signal); - our $VERSION = '0.92'; + our $VERSION = '0.93'; if ($threads::threads) { *cond_wait = \&cond_wait_enabled; diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index 1ac3dce832..dcaa7e7a9e 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -361,7 +361,7 @@ Perl_sharedsv_associate(pTHX_ SV **psv, SV *ssv, shared_sv *data) char* stash_ptr = SvPV((SV*) SvSTASH(ssv), len); HV* stash = gv_stashpvn(stash_ptr, len, TRUE); SvOBJECT_on(sv); - SvSTASH(sv) = (HV*)SvREFCNT_inc(stash); + SvSTASH_set(sv, (HV*)SvREFCNT_inc(stash)); } } break; @@ -503,7 +503,7 @@ sharedsv_scalar_mg_get(pTHX_ SV *sv, MAGIC *mg) SV *obj = Nullsv; Perl_sharedsv_associate(aTHX_ &obj, SvRV(SHAREDSvPTR(shared)), NULL); sv_setsv_nomg(sv, &PL_sv_undef); - SvRV(sv) = obj; + SvRV_set(sv, obj); SvROK_on(sv); } @@ -531,7 +531,7 @@ sharedsv_scalar_store(pTHX_ SV *sv, shared_sv *shared) if(SvOBJECT(SvRV(sv))) { SV* fake_stash = newSVpv(HvNAME(SvSTASH(SvRV(sv))),0); SvOBJECT_on(SHAREDSvPTR(target)); - SvSTASH(SHAREDSvPTR(target)) = (HV*)fake_stash; + SvSTASH_set(SHAREDSvPTR(target), (HV*)fake_stash); } CALLER_CONTEXT; } @@ -546,7 +546,7 @@ sharedsv_scalar_store(pTHX_ SV *sv, shared_sv *shared) if(SvOBJECT(sv)) { SV* fake_stash = newSVpv(HvNAME(SvSTASH(sv)),0); SvOBJECT_on(SHAREDSvPTR(shared)); - SvSTASH(SHAREDSvPTR(shared)) = (HV*)fake_stash; + SvSTASH_set(SHAREDSvPTR(shared), (HV*)fake_stash); } CALLER_CONTEXT; } @@ -643,7 +643,7 @@ sharedsv_elem_mg_FETCH(pTHX_ SV *sv, MAGIC *mg) SV *obj = Nullsv; Perl_sharedsv_associate(aTHX_ &obj, SvRV(*svp), NULL); sv_setsv_nomg(sv, &PL_sv_undef); - SvRV(sv) = obj; + SvRV_set(sv, obj); SvROK_on(sv); SvSETMAGIC(sv); } diff --git a/ext/threads/threads.pm b/ext/threads/threads.pm index dcd2aa015c..22180ad577 100755 --- a/ext/threads/threads.pm +++ b/ext/threads/threads.pm @@ -50,7 +50,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( async ); -our $VERSION = '1.05'; +our $VERSION = '1.06'; # || 0 to ensure compatibility with previous versions @@ -113,7 +113,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) if (SvLEN(gv)) { if (proto) { SvPV_set(gv, NULL); - SvLEN(gv) = 0; + SvLEN_set(gv, 0); SvPOK_off(gv); } else Safefree(SvPVX(gv)); @@ -526,7 +526,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method) */ CvSTASH(cv) = stash; SvPV_set(cv, (char *)name); /* cast to lose constness warning */ - SvCUR(cv) = len; + SvCUR_set(cv, len); return gv; } @@ -1190,7 +1190,7 @@ Perl_newIO(pTHX) /* unless exists($main::{FileHandle}) and defined(%main::FileHandle::) */ if (!(iogv && GvHV(iogv) && HvARRAY(GvHV(iogv)))) iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV); - SvSTASH(io) = (HV*)SvREFCNT_inc(GvHV(iogv)); + SvSTASH_set(io, (HV*)SvREFCNT_inc(GvHV(iogv))); return io; } @@ -1572,7 +1572,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) */ SV* newref = newSVsv(tmpRef); SvOBJECT_on(newref); - SvSTASH(newref) = (HV*)SvREFCNT_inc(SvSTASH(tmpRef)); + SvSTASH_set(newref, (HV*)SvREFCNT_inc(SvSTASH(tmpRef))); return newref; } } @@ -417,7 +417,7 @@ Perl_mg_free(pTHX_ SV *sv) SvREFCNT_dec(mg->mg_obj); Safefree(mg); } - SvMAGIC(sv) = 0; + SvMAGIC_set(sv, NULL); return 0; } @@ -777,11 +777,11 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) MAGIC* mg = SvMAGIC(sv); MAGIC* mgt; PL_tainted = 1; - SvMAGIC(sv) = mg->mg_moremagic; + SvMAGIC_set(sv, mg->mg_moremagic); SvTAINT(sv); if ((mgt = SvMAGIC(sv))) { mg->mg_moremagic = mgt; - SvMAGIC(sv) = mg; + SvMAGIC_set(sv, mg); } } else SvTAINTED_off(sv); @@ -1980,7 +1980,7 @@ Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg) if (!SvWEAKREF(svp[i])) Perl_croak(aTHX_ "panic: magic_killbackrefs"); /* XXX Should we check that it hasn't changed? */ - SvRV(svp[i]) = 0; + SvRV_set(svp[i], 0); SvOK_off(svp[i]); SvWEAKREF_off(svp[i]); svp[i] = Nullsv; @@ -3293,7 +3293,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) GV *gv = cGVOPx_gv(curop); if (gv == PL_defgv || (int)SvCUR(gv) == PL_generation) break; - SvCUR(gv) = PL_generation; + SvCUR_set(gv, PL_generation); } else if (curop->op_type == OP_PADSV || curop->op_type == OP_PADAV || @@ -3303,8 +3303,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) if (PAD_COMPNAME_GEN(curop->op_targ) == (STRLEN)PL_generation) break; - PAD_COMPNAME_GEN(curop->op_targ) - = PL_generation; + PAD_COMPNAME_GEN_set(curop->op_targ, PL_generation); } else if (curop->op_type == OP_RV2CV) @@ -3326,7 +3325,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) #endif if (gv == PL_defgv || (int)SvCUR(gv) == PL_generation) break; - SvCUR(gv) = PL_generation; + SvCUR_set(gv, PL_generation); } } else @@ -5884,7 +5883,7 @@ Perl_ck_require(pTHX_ OP *o) if (*s == ':' && s[1] == ':') { *s = '/'; Move(s+2, s+1, strlen(s+2)+1, char); - --SvCUR(kid->op_sv); + SvCUR_set(kid->op_sv, SvCUR(kid->op_sv) - 1); } } if (SvREADONLY(kid->op_sv)) { @@ -337,7 +337,7 @@ Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake if (typestash) { SvFLAGS(namesv) |= SVpad_TYPED; - SvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*) typestash); + SvSTASH_set(namesv, (HV*)SvREFCNT_inc((SV*) typestash)); } if (ourstash) { SvFLAGS(namesv) |= SVpad_OUR; @@ -205,7 +205,12 @@ Assumes the slot entry is a valid C<our> lexical. The generation number of the name at offset C<po> in the current compiling pad (lvalue). Note that C<SvCUR> is hijacked for this purpose. +=for apidoc m|STRLEN|PAD_COMPNAME_GEN_set|PADOFFSET po|int gen +Sets the generation number of the name at offset C<po> in the current +ling pad (lvalue) to C<gen>. Note that C<SvCUR_set> is hijacked for this purpose. + =cut + */ #define PAD_COMPNAME_FLAGS(po) SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE)) @@ -221,7 +226,7 @@ compiling pad (lvalue). Note that C<SvCUR> is hijacked for this purpose. #define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po]) - +#define PAD_COMPNAME_GEN_set(po, gen) SvCUR_set(AvARRAY(PL_comppad_name)[po], gen) /* @@ -3611,7 +3611,7 @@ struct perl_debug_pad { }; #define PERL_DEBUG_PAD(i) &(PL_debug_pad.pad[i]) -#define PERL_DEBUG_PAD_ZERO(i) (SvPVX(PERL_DEBUG_PAD(i))[0] = 0, SvCUR(PERL_DEBUG_PAD(i)) = 0, PERL_DEBUG_PAD(i)) +#define PERL_DEBUG_PAD_ZERO(i) (SvPVX(PERL_DEBUG_PAD(i))[0] = 0, SvCUR_set(PERL_DEBUG_PAD(i), 0), PERL_DEBUG_PAD(i)) /* Enable variables which are pointers to functions */ typedef void (CPERLscope(*peep_t))(pTHX_ OP* o); @@ -178,9 +178,10 @@ PP(pp_rv2gv) SvOOK_off(sv); /* backoff */ if (SvLEN(sv)) Safefree(SvPVX(sv)); - SvLEN(sv)=SvCUR(sv)=0; + SvLEN_set(sv, 0); + SvCUR_set(sv, 0); } - SvRV(sv) = (SV*)gv; + SvRV_set(sv, (SV*)gv); SvROK_on(sv); SvSETMAGIC(sv); goto wasref; @@ -493,7 +494,7 @@ S_refto(pTHX_ SV *sv) } rv = sv_newmortal(); sv_upgrade(rv, SVt_RV); - SvRV(rv) = sv; + SvRV_set(rv, sv); SvROK_on(rv); return rv; } @@ -1494,7 +1495,7 @@ PP(pp_repeat) MEM_WRAP_CHECK_1(max, char, oom_string_extend); SvGROW(TARG, (count * len) + 1); repeatcpy(SvPVX(TARG) + len, SvPVX(TARG), len, count - 1); - SvCUR(TARG) *= count; + SvCUR_set(TARG, SvCUR(TARG) * count); } *SvEND(TARG) = '\0'; } @@ -476,7 +476,7 @@ and C<PUSHu>. changed SV* ref to SV* tmpRef */ #define RvDEEPCP(rv) STMT_START { SV* tmpRef=SvRV(rv); \ if (SvREFCNT(tmpRef)>1) { \ - SvRV(rv)=AMG_CALLun(rv,copy); \ + SvRV_set(rv, AMG_CALLun(rv,copy)); \ SvREFCNT_dec(tmpRef); \ } } STMT_END @@ -1599,7 +1599,7 @@ Perl_do_readline(pTHX) tmps = SvEND(sv) - 1; if (*tmps == *SvPVX(PL_rs)) { *tmps = '\0'; - SvCUR(sv)--; + SvCUR_set(sv, SvCUR(sv) - 1); } } for (tmps = SvPVX(sv); *tmps; tmps++) @@ -2935,17 +2935,18 @@ Perl_vivify_ref(pTHX_ SV *sv, U32 to_what) else if (SvTYPE(sv) >= SVt_PV) { SvOOK_off(sv); Safefree(SvPVX(sv)); - SvLEN(sv) = SvCUR(sv) = 0; + SvLEN_set(sv, 0); + SvCUR_set(sv, 0); } switch (to_what) { case OPpDEREF_SV: - SvRV(sv) = NEWSV(355,0); + SvRV_set(sv, NEWSV(355,0)); break; case OPpDEREF_AV: - SvRV(sv) = (SV*)newAV(); + SvRV_set(sv, (SV*)newAV()); break; case OPpDEREF_HV: - SvRV(sv) = (SV*)newHV(); + SvRV_set(sv, (SV*)newHV()); break; } SvROK_on(sv); @@ -708,7 +708,7 @@ STMT_START { \ if (utf8) gl *= UTF8_EXPAND; \ if ((cur) + gl >= (start) + SvLEN(cat)) { \ *cur = '\0'; \ - SvCUR(cat) = (cur) - (start); \ + SvCUR_set((cat), (cur) - (start)); \ (start) = sv_exp_grow(aTHX_ cat, gl); \ (cur) = (start) + SvCUR(cat); \ } \ @@ -2444,7 +2444,7 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) { if (SvOOK(sv)) { if (SvIVX(sv)) { - SvLEN(sv) += SvIVX(sv); + SvLEN_set(sv, SvLEN(sv) + SvIVX(sv)); from_start -= SvIVX(sv); SvIV_set(sv, 0); } @@ -2453,8 +2453,8 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) { if (SvLEN(sv) != 0) Safefree(from_start); SvPV_set(sv, to_start); - SvCUR(sv) = to_ptr - to_start; - SvLEN(sv) = len; + SvCUR_set(sv, to_ptr - to_start); + SvLEN_set(sv, len); SvUTF8_on(sv); } @@ -2980,7 +2980,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) W_utf8: if (cur > end) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); GROWING(0, cat, start, cur, len+UTF8_MAXLEN); end = start+SvLEN(cat)-UTF8_MAXLEN; @@ -2993,7 +2993,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) if (auv >= 0x100) { if (!SvUTF8(cat)) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); marked_upgrade(aTHX_ cat, symptr); lookahead.flags |= FLAG_DO_UTF8; lookahead.strbeg = symptr->strbeg; @@ -3010,7 +3010,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) } if (cur >= end) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); GROWING(0, cat, start, cur, len+1); end = start+SvLEN(cat)-1; } @@ -3045,7 +3045,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) 0 : UNICODE_ALLOW_ANY); if (cur+(endb-buffer)*UTF8_EXPAND >= end) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); GROWING(0, cat, start, cur, len+(endb-buffer)*UTF8_EXPAND); end = start+SvLEN(cat); @@ -3054,7 +3054,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) } else { if (cur >= end) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); GROWING(0, cat, start, cur, len+UTF8_MAXLEN); end = start+SvLEN(cat)-UTF8_MAXLEN; } @@ -3287,7 +3287,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) if (anv < 0) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); Perl_croak(aTHX_ "Cannot compress negative numbers in pack"); } @@ -3533,7 +3533,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) if (!uni_to_bytes(aTHX_ &aptr, aend, buffer, todo, 'u' | TYPE_IS_PACK)) { *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); Perl_croak(aTHX_ "Assertion: string is shorter than advertised"); } end = doencodes(hunk, buffer, todo); @@ -3548,7 +3548,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) } } *cur = '\0'; - SvCUR(cat) = cur - start; + SvCUR_set(cat, cur - start); no_change: *symptr = lookahead; } @@ -2386,7 +2386,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg SvGROW(last_str, (mincount * l) + 1); repeatcpy(SvPVX(last_str) + l, SvPVX(last_str), l, mincount - 1); - SvCUR(last_str) *= mincount; + SvCUR_set(last_str, SvCUR(last_str) * mincount); /* Add additional parts. */ SvCUR_set(data->last_found, SvCUR(data->last_found) - l); @@ -170,7 +170,7 @@ S_save_scalar_at(pTHX_ SV **sptr) (SVp_NOK|SVp_POK)) >> PRIVSHIFT; PL_tainted = oldtainted; } - SvMAGIC(sv) = SvMAGIC(osv); + SvMAGIC_set(sv, SvMAGIC(osv)); /* if it's a special scalar or if it has no 'set' magic, * propagate the SvREADONLY flag. --rgs 20030922 */ for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -265,7 +265,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) { SSGROW(6); SSPUSHIV((IV)SvLEN(gv)); - SvLEN(gv) = 0; /* forget that anything was allocated here */ + SvLEN_set(gv, 0); /* forget that anything was allocated here */ SSPUSHIV((IV)SvCUR(gv)); SSPUSHPTR(SvPVX(gv)); SvPOK_off(gv); @@ -314,10 +314,10 @@ Perl_save_ary(pTHX_ GV *gv) GvAV(gv) = Null(AV*); av = GvAVn(gv); if (SvMAGIC(oav)) { - SvMAGIC(av) = SvMAGIC(oav); + SvMAGIC_set(av, SvMAGIC(oav)); SvFLAGS((SV*)av) |= SvMAGICAL(oav); SvMAGICAL_off(oav); - SvMAGIC(oav) = 0; + SvMAGIC_set(oav, NULL); PL_localizing = 1; SvSETMAGIC((SV*)av); PL_localizing = 0; @@ -338,10 +338,10 @@ Perl_save_hash(pTHX_ GV *gv) GvHV(gv) = Null(HV*); hv = GvHVn(gv); if (SvMAGIC(ohv)) { - SvMAGIC(hv) = SvMAGIC(ohv); + SvMAGIC_set(hv, SvMAGIC(ohv)); SvFLAGS((SV*)hv) |= SvMAGICAL(ohv); SvMAGICAL_off(ohv); - SvMAGIC(ohv) = 0; + SvMAGIC_set(ohv, NULL); PL_localizing = 1; SvSETMAGIC((SV*)hv); PL_localizing = 0; @@ -725,10 +725,10 @@ Perl_leave_scope(pTHX_ I32 base) SvTYPE(sv) != SVt_PVGV) { (void)SvUPGRADE(value, SvTYPE(sv)); - SvMAGIC(value) = SvMAGIC(sv); + SvMAGIC_set(value, SvMAGIC(sv)); SvFLAGS(value) |= SvMAGICAL(sv); SvMAGICAL_off(sv); - SvMAGIC(sv) = 0; + SvMAGIC_set(sv, 0); } /* XXX This branch is pretty bogus. This code irretrievably * clears(!) the magic on the SV (either to avoid further @@ -743,7 +743,7 @@ Perl_leave_scope(pTHX_ I32 base) SvMAGICAL_off(value); /* XXX this is a leak when we get here because the * mg_get() in save_scalar_at() croaked */ - SvMAGIC(value) = 0; + SvMAGIC_set(value, NULL); } *(SV**)ptr = value; SvREFCNT_dec(sv); @@ -759,10 +759,10 @@ Perl_leave_scope(pTHX_ I32 base) gv = (GV*)SSPOPPTR; if (GvAV(gv)) { AV * const goner = GvAV(gv); - SvMAGIC(av) = SvMAGIC(goner); + SvMAGIC_set(av, SvMAGIC(goner)); SvFLAGS((SV*)av) |= SvMAGICAL(goner); SvMAGICAL_off(goner); - SvMAGIC(goner) = 0; + SvMAGIC_set(goner, NULL); SvREFCNT_dec(goner); } GvAV(gv) = av; @@ -777,10 +777,10 @@ Perl_leave_scope(pTHX_ I32 base) gv = (GV*)SSPOPPTR; if (GvHV(gv)) { HV * const goner = GvHV(gv); - SvMAGIC(hv) = SvMAGIC(goner); + SvMAGIC_set(hv, SvMAGIC(goner)); SvFLAGS(hv) |= SvMAGICAL(goner); SvMAGICAL_off(goner); - SvMAGIC(goner) = 0; + SvMAGIC_set(goner, NULL); SvREFCNT_dec(goner); } GvHV(gv) = hv; @@ -846,8 +846,8 @@ Perl_leave_scope(pTHX_ I32 base) Safefree(SvPVX(gv)); } SvPV_set(gv, (char *)SSPOPPTR); - SvCUR(gv) = (STRLEN)SSPOPIV; - SvLEN(gv) = (STRLEN)SSPOPIV; + SvCUR_set(gv, (STRLEN)SSPOPIV); + SvLEN_set(gv, (STRLEN)SSPOPIV); gp_free(gv); GvGP(gv) = (GP*)ptr; if (GvCVu(gv)) @@ -416,10 +416,10 @@ do_clean_objs(pTHX_ SV *sv) if (SvWEAKREF(sv)) { sv_del_backref(sv); SvWEAKREF_off(sv); - SvRV(sv) = 0; + SvRV_set(sv, NULL); } else { SvROK_off(sv); - SvRV(sv) = 0; + SvRV_set(sv, NULL); SvREFCNT_dec(rv); } } @@ -1906,19 +1906,19 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) break; case SVt_RV: SvANY(sv) = new_XRV(); - SvRV(sv) = (SV*)pv; + SvRV_set(sv, (SV*)pv); break; case SVt_PV: SvANY(sv) = new_XPV(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); break; case SVt_PVIV: SvANY(sv) = new_XPVIV(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); if (SvNIOK(sv)) (void)SvIOK_on(sv); @@ -1927,30 +1927,30 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_PVNV: SvANY(sv) = new_XPVNV(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); break; case SVt_PVMG: SvANY(sv) = new_XPVMG(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); break; case SVt_PVLV: SvANY(sv) = new_XPVLV(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); LvTARGOFF(sv) = 0; LvTARGLEN(sv) = 0; LvTARG(sv) = 0; @@ -1970,8 +1970,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) AvFILLp(sv) = -1; SvIV_set(sv, 0); SvNV_set(sv, 0.0); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); AvALLOC(sv) = 0; AvARYLEN(sv) = 0; AvFLAGS(sv) = AVf_REAL; @@ -1985,8 +1985,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) HvMAX(sv) = 0; HvTOTALKEYS(sv) = 0; HvPLACEHOLDERS(sv) = 0; - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); HvRITER(sv) = 0; HvEITER(sv) = 0; HvPMROOT(sv) = 0; @@ -1996,22 +1996,22 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvANY(sv) = new_XPVCV(); Zero(SvANY(sv), 1, XPVCV); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); break; case SVt_PVGV: SvANY(sv) = new_XPVGV(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); GvGP(sv) = 0; GvNAME(sv) = 0; GvNAMELEN(sv) = 0; @@ -2021,12 +2021,12 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_PVBM: SvANY(sv) = new_XPVBM(); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); BmRARE(sv) = 0; BmUSEFUL(sv) = 0; BmPREVIOUS(sv) = 0; @@ -2035,23 +2035,23 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvANY(sv) = new_XPVFM(); Zero(SvANY(sv), 1, XPVFM); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); break; case SVt_PVIO: SvANY(sv) = new_XPVIO(); Zero(SvANY(sv), 1, XPVIO); SvPV_set(sv, pv); - SvCUR(sv) = cur; - SvLEN(sv) = len; + SvCUR_set(sv, cur); + SvLEN_set(sv, len); SvIV_set(sv, iv); SvNV_set(sv, nv); - SvMAGIC(sv) = magic; - SvSTASH(sv) = stash; + SvMAGIC_set(sv, magic); + SvSTASH_set(sv, stash); IoPAGE_LEN(sv) = 60; break; } @@ -2073,7 +2073,7 @@ Perl_sv_backoff(pTHX_ register SV *sv) assert(SvOOK(sv)); if (SvIVX(sv)) { char *s = SvPVX(sv); - SvLEN(sv) += SvIVX(sv); + SvLEN_set(sv, SvLEN(sv) + SvIVX(sv)); SvPV_set(sv, SvPVX(sv) - SvIVX(sv)); SvIV_set(sv, 0); Move(s, SvPVX(sv), SvCUR(sv)+1, char); @@ -3996,10 +3996,10 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags) s = (U8*)SvPVX(sv); len = SvCUR(sv) + 1; /* Plus the \0 */ SvPV_set(sv, (char*)bytes_to_utf8((U8*)s, &len)); - SvCUR(sv) = len - 1; + SvCUR_set(sv, len - 1); if (SvLEN(sv) != 0) Safefree(s); /* No longer using what was there before. */ - SvLEN(sv) = len; /* No longer know the real size. */ + SvLEN_set(sv, len); /* No longer know the real size. */ } /* Mark as UTF-8 even if no hibit - saves scanning loop */ SvUTF8_on(sv); @@ -4044,7 +4044,7 @@ Perl_sv_utf8_downgrade(pTHX_ register SV* sv, bool fail_ok) Perl_croak(aTHX_ "Wide character"); } } - SvCUR(sv) = len; + SvCUR_set(sv, len); } } SvUTF8_off(sv); @@ -4486,11 +4486,12 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) (void)SvOOK_off(dstr); /* backoff */ if (SvLEN(dstr)) Safefree(SvPVX(dstr)); - SvLEN(dstr)=SvCUR(dstr)=0; + SvLEN_set(dstr, 0); + SvCUR_set(dstr, 0); } } (void)SvOK_off(dstr); - SvRV(dstr) = SvREFCNT_inc(SvRV(sstr)); + SvRV_set(dstr, SvREFCNT_inc(SvRV(sstr))); SvROK_on(dstr); if (sflags & SVp_NOK) { SvNOKp_on(dstr); @@ -5044,7 +5045,7 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags) SvFAKE_off(sv); SvREADONLY_off(sv); SvPV_set(sv, (char*)0); - SvLEN(sv) = 0; + SvLEN_set(sv, 0); SvGROW(sv, len + 1); Move(pvx,SvPVX(sv),len,char); *SvEND(sv) = '\0'; @@ -5115,8 +5116,8 @@ Perl_sv_chop(pTHX_ register SV *sv, register char *ptr) SvFLAGS(sv) |= SVf_OOK; } SvNIOK_off(sv); - SvLEN(sv) -= delta; - SvCUR(sv) -= delta; + SvLEN_set(sv, SvLEN(sv) - delta); + SvCUR_set(sv, SvCUR(sv) - delta); SvPV_set(sv, SvPVX(sv) + delta); SvIV_set(sv, SvIVX(sv) + delta); } @@ -5162,7 +5163,7 @@ Perl_sv_catpvn_flags(pTHX_ register SV *dsv, register const char *sstr, register if (sstr == dstr) sstr = SvPVX(dsv); Move(sstr, SvPVX(dsv) + dlen, slen, char); - SvCUR(dsv) += slen; + SvCUR_set(dsv, SvCUR(dsv) + slen); *SvEND(dsv) = '\0'; (void)SvPOK_only_UTF8(dsv); /* validate pointer */ SvTAINT(dsv); @@ -5285,7 +5286,7 @@ Perl_sv_catpv(pTHX_ register SV *sv, register const char *ptr) if (ptr == junk) ptr = SvPVX(sv); Move(ptr,SvPVX(sv)+tlen,len+1,char); - SvCUR(sv) += len; + SvCUR_set(sv, SvCUR(sv) + len); (void)SvPOK_only_UTF8(sv); /* validate pointer */ SvTAINT(sv); } @@ -5357,7 +5358,7 @@ Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtable, } Newz(702,mg, 1, MAGIC); mg->mg_moremagic = SvMAGIC(sv); - SvMAGIC(sv) = mg; + SvMAGIC_set(sv, mg); /* Sometimes a magic contains a reference loop, where the sv and object refer to each other. To prevent a reference loop that @@ -5758,7 +5759,7 @@ Perl_sv_insert(pTHX_ SV *bigstr, STRLEN offset, STRLEN len, const char *little, while (midend > mid) /* shove everything down */ *--bigend = *--midend; Move(little,big+offset,littlelen,char); - SvCUR(bigstr) += i; + SvCUR_set(bigstr, SvCUR(bigstr) + i); SvSETMAGIC(bigstr); return; } @@ -5836,10 +5837,10 @@ Perl_sv_replace(pTHX_ register SV *sv, register SV *nsv) mg_free(nsv); else sv_upgrade(nsv, SVt_PVMG); - SvMAGIC(nsv) = SvMAGIC(sv); + SvMAGIC_set(nsv, SvMAGIC(sv)); SvFLAGS(nsv) |= SvMAGICAL(sv); SvMAGICAL_off(sv); - SvMAGIC(sv) = 0; + SvMAGIC_set(sv, NULL); } SvREFCNT(sv) = 0; sv_clear(sv); @@ -5929,7 +5930,7 @@ Perl_sv_clear(pTHX_ register SV *sv) if(SvREFCNT(tmpref) < 2) { /* tmpref is not kept alive! */ SvREFCNT(sv)--; - SvRV(tmpref) = 0; + SvRV_set(tmpref, NULL); SvROK_off(tmpref); } SvREFCNT_dec(tmpref); @@ -7440,7 +7441,7 @@ Perl_sv_inc(pTHX_ register SV *sv) } /* oh,oh, the number grew */ SvGROW(sv, SvCUR(sv) + 2); - SvCUR(sv)++; + SvCUR_set(sv, SvCUR(sv) + 1); for (d = SvPVX(sv) + SvCUR(sv); d > SvPVX(sv); d--) *d = d[-1]; if (isDIGIT(d[1])) @@ -7710,9 +7711,9 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash) new_SV(sv); sv_upgrade(sv, SVt_PVIV); SvPV_set(sv, sharepvn(src, is_utf8?-len:len, hash)); - SvCUR(sv) = len; + SvCUR_set(sv, len); SvUV_set(sv, hash); - SvLEN(sv) = 0; + SvLEN_set(sv, 0); SvREADONLY_on(sv); SvFAKE_on(sv); SvPOK_on(sv); @@ -7847,7 +7848,7 @@ Perl_newRV_noinc(pTHX_ SV *tmpRef) new_SV(sv); sv_upgrade(sv, SVt_RV); SvTEMP_off(tmpRef); - SvRV(sv) = tmpRef; + SvRV_set(sv, tmpRef); SvROK_on(sv); return sv; } @@ -8560,7 +8561,7 @@ Perl_newSVrv(pTHX_ SV *rv, const char *classname) } SvOK_off(rv); - SvRV(rv) = sv; + SvRV_set(rv, sv); SvROK_on(rv); if (classname) { @@ -8709,7 +8710,7 @@ Perl_sv_bless(pTHX_ SV *sv, HV *stash) if (SvTYPE(tmpRef) != SVt_PVIO) ++PL_sv_objcount; (void)SvUPGRADE(tmpRef, SVt_PVMG); - SvSTASH(tmpRef) = (HV*)SvREFCNT_inc(stash); + SvSTASH_set(tmpRef, (HV*)SvREFCNT_inc(stash)); if (Gv_AMG(stash)) SvAMAGIC_on(sv); @@ -8777,10 +8778,10 @@ Perl_sv_unref_flags(pTHX_ SV *sv, U32 flags) if (SvWEAKREF(sv)) { sv_del_backref(sv); SvWEAKREF_off(sv); - SvRV(sv) = 0; + SvRV_set(sv, NULL); return; } - SvRV(sv) = 0; + SvRV_set(sv, NULL); SvROK_off(sv); /* You can't have a || SvREADONLY(rv) here, as $a = $$a, where $a was assigned to as BEGIN {$a = \"Foo"} will fail. */ @@ -10094,7 +10095,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV Copy(eptr, p, elen, char); p += elen; *p = '\0'; - SvCUR(sv) = p - SvPVX(sv); + SvCUR_set(sv, p - SvPVX(sv)); svix = osvix; continue; /* not "break" */ } @@ -10160,7 +10161,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV if (has_utf8) SvUTF8_on(sv); *p = '\0'; - SvCUR(sv) = p - SvPVX(sv); + SvCUR_set(sv, p - SvPVX(sv)); if (vectorize) { esignlen = 0; goto vector; @@ -10672,9 +10673,9 @@ void Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) { if (SvROK(sstr)) { - SvRV(dstr) = SvWEAKREF(sstr) - ? sv_dup(SvRV(sstr), param) - : sv_dup_inc(SvRV(sstr), param); + SvRV_set(dstr, SvWEAKREF(sstr) + ? sv_dup(SvRV(sstr), param) + : sv_dup_inc(SvRV(sstr), param)); } else if (SvPVX(sstr)) { @@ -10717,7 +10718,7 @@ Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) else { /* Copy the Null */ if (SvTYPE(dstr) == SVt_RV) - SvRV(dstr) = 0; + SvRV_set(dstr, NULL); else SvPV_set(dstr, 0); } @@ -10800,43 +10801,43 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) break; case SVt_PV: SvANY(dstr) = new_XPV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); break; case SVt_PVIV: SvANY(dstr) = new_XPVIV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); break; case SVt_PVNV: SvANY(dstr) = new_XPVNV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); break; case SVt_PVMG: SvANY(dstr) = new_XPVMG(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); break; case SVt_PVBM: SvANY(dstr) = new_XPVBM(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); BmRARE(dstr) = BmRARE(sstr); BmUSEFUL(dstr) = BmUSEFUL(sstr); @@ -10844,12 +10845,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) break; case SVt_PVLV: SvANY(dstr) = new_XPVLV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); LvTARGOFF(dstr) = LvTARGOFF(sstr); /* XXX sometimes holds PMOP* when DEBUGGING */ LvTARGLEN(dstr) = LvTARGLEN(sstr); @@ -10876,12 +10877,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) } } SvANY(dstr) = new_XPVGV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); GvNAMELEN(dstr) = GvNAMELEN(sstr); GvNAME(dstr) = SAVEPVN(GvNAME(sstr), GvNAMELEN(sstr)); @@ -10892,12 +10893,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) break; case SVt_PVIO: SvANY(dstr) = new_XPVIO(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); IoIFP(dstr) = fp_dup(IoIFP(sstr), IoTYPE(sstr), param); if (IoOFP(sstr) == IoIFP(sstr)) @@ -10934,12 +10935,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) break; case SVt_PVAV: SvANY(dstr) = new_XPVAV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); AvARYLEN((AV*)dstr) = sv_dup_inc(AvARYLEN((AV*)sstr), param); AvFLAGS((AV*)dstr) = AvFLAGS((AV*)sstr); if (AvARRAY((AV*)sstr)) { @@ -10971,12 +10972,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) break; case SVt_PVHV: SvANY(dstr) = new_XPVHV(); - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); HvRITER((HV*)dstr) = HvRITER((HV*)sstr); if (HvARRAY((HV*)sstr)) { STRLEN i = 0; @@ -11011,12 +11012,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) case SVt_PVCV: SvANY(dstr) = new_XPVCV(); dup_pvcv: - SvCUR(dstr) = SvCUR(sstr); - SvLEN(dstr) = SvLEN(sstr); + SvCUR_set(dstr, SvCUR(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); SvIV_set(dstr, SvIVX(sstr)); SvNV_set(dstr, SvNVX(sstr)); - SvMAGIC(dstr) = mg_dup(SvMAGIC(sstr), param); - SvSTASH(dstr) = hv_dup_inc(SvSTASH(sstr), param); + SvMAGIC_set(dstr, mg_dup(SvMAGIC(sstr), param)); + SvSTASH_set(dstr, hv_dup_inc(SvSTASH(sstr), param)); Perl_rvpv_dup(aTHX_ dstr, sstr, param); CvSTASH(dstr) = hv_dup(CvSTASH(sstr), param); /* NOTE: not refcounted */ CvSTART(dstr) = CvSTART(sstr); @@ -11726,8 +11727,8 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvFLAGS(&PL_sv_no) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; SvPV_set(&PL_sv_no, SAVEPVN(PL_No, 0)); - SvCUR(&PL_sv_no) = 0; - SvLEN(&PL_sv_no) = 1; + SvCUR_set(&PL_sv_no, 0); + SvLEN_set(&PL_sv_no, 1); SvIV_set(&PL_sv_no, 0); SvNV_set(&PL_sv_no, 0); ptr_table_store(PL_ptr_table, &proto_perl->Isv_no, &PL_sv_no); @@ -11737,8 +11738,8 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvFLAGS(&PL_sv_yes) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; SvPV_set(&PL_sv_yes, SAVEPVN(PL_Yes, 1)); - SvCUR(&PL_sv_yes) = 1; - SvLEN(&PL_sv_yes) = 2; + SvCUR_set(&PL_sv_yes, 1); + SvLEN_set(&PL_sv_yes, 2); SvIV_set(&PL_sv_yes, 1); SvNV_set(&PL_sv_yes, 1); ptr_table_store(PL_ptr_table, &proto_perl->Isv_yes, &PL_sv_yes); @@ -734,23 +734,30 @@ in gv.h: */ #define SvREPADTMP_off(sv) (SvFLAGS(sv) &= ~SVf_FAKE) #endif +#ifdef PERL_DEBUG_COW +#define SvRV(sv) (0 + ((XRV*) SvANY(sv))->xrv_rv) +#else #define SvRV(sv) ((XRV*) SvANY(sv))->xrv_rv +#endif #define SvRVx(sv) SvRV(sv) #ifdef PERL_DEBUG_COW #define SvIVX(sv) (0 + ((XPVIV*) SvANY(sv))->xiv_iv) -#define SvUVX(sv) (0 + (XPVUV*) SvANY(sv))->xuv_uv -#define SvNVX(sv) (0.0 + ((XPVNV*)SvANY(sv))->xnv_nv) +#define SvUVX(sv) (0 + ((XPVUV*) SvANY(sv))->xuv_uv) +#define SvNVX(sv) (0 + ((XPVNV*)SvANY(sv))->xnv_nv) #define SvPVX(sv) (0 + ((XPV*) SvANY(sv))->xpv_pv) +#define SvCUR(sv) (0 + ((XPV*) SvANY(sv))->xpv_cur) +#define SvLEN(sv) (0 + ((XPV*) SvANY(sv))->xpv_len) +#define SvEND(sv) (0 + (((XPV*) SvANY(sv))->xpv_pv + ((XPV*)SvANY(sv))->xpv_cur)) #else #define SvIVX(sv) ((XPVIV*) SvANY(sv))->xiv_iv #define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv #define SvNVX(sv) ((XPVNV*)SvANY(sv))->xnv_nv -#define SvPVX(sv) ((XPV*) SvANY(sv))->xpv_pv -#endif +#define SvPVX(sv) ((XPV*) SvANY(sv))->xpv_pv #define SvCUR(sv) ((XPV*) SvANY(sv))->xpv_cur #define SvLEN(sv) ((XPV*) SvANY(sv))->xpv_len #define SvEND(sv)(((XPV*) SvANY(sv))->xpv_pv + ((XPV*)SvANY(sv))->xpv_cur) +#endif #define SvIVXx(sv) SvIVX(sv) #define SvUVXx(sv) SvUVX(sv) @@ -785,15 +792,21 @@ in gv.h: */ #define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*)SvANY(sv))->xuv_uv = (val)); } STMT_END +#define SvRV_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ + (((XRV*)SvANY(sv))->xrv_rv = (val)); } STMT_END +#define SvMAGIC_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ + (((XPVMG*)SvANY(sv))->xmg_magic = (val)); } STMT_END +#define SvSTASH_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ + (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END #define SvCUR_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - (SvCUR(sv) = (val)); } STMT_END + (((XPV*) SvANY(sv))->xpv_cur = (val)); } STMT_END #define SvLEN_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - (SvLEN(sv) = (val)); } STMT_END -#define SvEND_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - (SvCUR(sv) = (val) - SvPVX(sv)); } STMT_END + (((XPV*) SvANY(sv))->xpv_len = (val)); } STMT_END #define SvPV_renew(sv,n) \ STMT_START { SvLEN_set(sv, n); \ @@ -5267,7 +5267,7 @@ Perl_yylex(pTHX) Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "Illegal character in prototype for %"SVf" : %s", PL_subname, d); - SvCUR(PL_lex_stuff) = tmp; + SvCUR_set(PL_lex_stuff, tmp); have_proto = TRUE; s = skipspace(s); @@ -10539,7 +10539,7 @@ S_scan_formline(pTHX_ register char *s) char *end = SvPVX(stuff) + SvCUR(stuff); end[-2] = '\n'; end[-1] = '\0'; - SvCUR(stuff)--; + SvCUR_set(stuff, SvCUR(stuff) - 1); } #endif } |