diff options
author | Steve Peters <steve@fisharerojo.org> | 2005-04-20 01:27:20 -0500 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-04-20 13:51:54 +0000 |
commit | 87a1ef3dbc71790d3dec7643306775e0d1e4768a (patch) | |
tree | 2c16cb1d368f45d3771e5d57065ec0d7f74dc419 | |
parent | bd4b1eb5b0b53616d16d03ba8f6aedf325adfa1d (diff) | |
download | perl-87a1ef3dbc71790d3dec7643306775e0d1e4768a.tar.gz |
Refactoring to Sv*_set() macros - patch #6
Message-ID: <20050420112720.GA31042@mccoy.peters.homeunix.org>
Date: Wed, 20 Apr 2005 06:27:20 -0500
p4raw-id: //depot/perl@24260
-rw-r--r-- | bytecode.pl | 12 | ||||
-rw-r--r-- | ext/ByteLoader/bytecode.h | 7 | ||||
-rw-r--r-- | malloc.c | 3 | ||||
-rw-r--r-- | sv.c | 12 |
4 files changed, 21 insertions, 13 deletions
diff --git a/bytecode.pl b/bytecode.pl index d471763a9f..adf1d1fa46 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -368,12 +368,12 @@ sv_upgrade bstate->bs_sv U8 x sv_refcnt SvREFCNT(bstate->bs_sv) U32 sv_refcnt_add SvREFCNT(bstate->bs_sv) I32 x sv_flags SvFLAGS(bstate->bs_sv) U32 -xrv SvRV(bstate->bs_sv) svindex +xrv bstate->bs_sv svindex x xpv bstate->bs_sv none x -xpv_cur SvCUR(bstate->bs_sv) STRLEN -xpv_len SvLEN(bstate->bs_sv) STRLEN -xiv SvIVX(bstate->bs_sv) IV -xnv SvNVX(bstate->bs_sv) NV +xpv_cur bstate->bs_sv STRLEN x +xpv_len bstate->bs_sv STRLEN x +xiv bstate->bs_sv IV x +xnv bstate->bs_sv NV x xlv_targoff LvTARGOFF(bstate->bs_sv) STRLEN xlv_targlen LvTARGLEN(bstate->bs_sv) STRLEN xlv_targ LvTARG(bstate->bs_sv) svindex @@ -422,7 +422,7 @@ mg_private SvMAGIC(bstate->bs_sv)->mg_private U16 mg_flags SvMAGIC(bstate->bs_sv)->mg_flags U8 mg_name SvMAGIC(bstate->bs_sv) pvcontents x mg_namex SvMAGIC(bstate->bs_sv) svindex x -xmg_stash *(SV**)&SvSTASH(bstate->bs_sv) svindex +xmg_stash bstate->bs_sv svindex X gv_fetchpv bstate->bs_sv strconst x gv_fetchpvx bstate->bs_sv strconst x gv_stashpv bstate->bs_sv strconst x diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index 0224625c20..11e7f5fb4e 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -126,12 +126,19 @@ typedef char *pvindex; #define BSET_mg_namex(mg, arg) \ (mg->mg_ptr = (char*)SvREFCNT_inc((SV*)arg), \ mg->mg_len = HEf_SVKEY) +#define BSET_xmg_stash(sv, arg) SvSTASH_set(sv, arg) #define BSET_sv_upgrade(sv, arg) (void)SvUPGRADE(sv, arg) +#define BSET_xrv(sv, arg) SvRV_set(sv, arg) #define BSET_xpv(sv) do { \ SvPV_set(sv, bstate->bs_pv.xpv_pv); \ SvCUR_set(sv, bstate->bs_pv.xpv_cur); \ SvLEN_set(sv, bstate->bs_pv.xpv_len); \ } while (0) +#define BSET_xpv_cur(sv, arg) SvCUR_set(sv, arg) +#define BSET_xpv_len(sv, arg) SvLEN_set(sv, arg) +#define BSET_xiv(sv, arg) SvIV_set(sv, arg) +#define BSET_xnv(sv, arg) SvNV_set(sv, arg) + #define BSET_av_extend(sv, arg) av_extend((AV*)sv, arg) #define BSET_av_push(sv, arg) av_push((AV*)sv, arg) @@ -1176,7 +1176,8 @@ perl_get_emergency_buffer(IV *size) SvPOK_off(sv); SvPV_set(sv, Nullch); - SvCUR(sv) = SvLEN(sv) = 0; + SvCUR_set(sv, 0); + SvLEN_set(sv, 0); *size = malloced_size(pv) + M_OVERHEAD; return pv - sizeof(union overhead); } @@ -4541,8 +4541,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) (sflags & SVf_UTF8?-cur:cur), hash)); SvUV_set(dstr, hash); } - SvLEN(dstr) = len; - SvCUR(dstr) = cur; + SvLEN_set(dstr, len); + SvCUR_set(dstr, cur); SvREADONLY_on(dstr); SvFAKE_on(dstr); /* Relesase a global SV mutex. */ @@ -4703,8 +4703,8 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *sstr) SvFLAGS(dstr) = (SVt_PVIV|SVf_POK|SVp_POK|SVf_FAKE|SVf_READONLY); if (SvUTF8(sstr)) SvUTF8_on(dstr); - SvLEN(dstr) = len; - SvCUR(dstr) = cur; + SvLEN_set(dstr, len); + SvCUR_set(dstr, cur); if (DEBUG_C_TEST) { sv_dump(dstr); } @@ -4944,14 +4944,14 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags) SvREADONLY_off(sv); /* This SV doesn't own the buffer, so need to New() a new one: */ SvPV_set(sv, (char*)0); - SvLEN(sv) = 0; + SvLEN_set(sv, 0); if (flags & SV_COW_DROP_PV) { /* OK, so we don't need to copy our buffer. */ SvPOK_off(sv); } else { SvGROW(sv, cur + 1); Move(pvx,SvPVX(sv),cur,char); - SvCUR(sv) = cur; + SvCUR_set(sv, cur); *SvEND(sv) = '\0'; } sv_release_COW(sv, pvx, cur, len, hash, next); |