From: Reini Urban Date: Mon, 9 Jun 2008 17:15:41 +0000 (+0200) Subject: Re: [PATCH] More COW lvalues X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ec35e0f92217816d70cf483b3b012476ca9b9d7;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] More COW lvalues Message-ID: <484D491D.9050704@x-ray.at> Date: Mon, 09 Jun 2008 17:15:41 +0200 p4raw-id: //depot/perl@34038 --- diff --git a/regcomp.c b/regcomp.c index 9d8008e..6a77d55 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5669,13 +5669,17 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) pv = (I32*)SvGROW(sv_dat, SvCUR(sv_dat) + sizeof(I32)+1); SvCUR_set(sv_dat, SvCUR(sv_dat) + sizeof(I32)); pv[count] = RExC_npar; - SvIVX(sv_dat)++; +#ifdef PERL_DEBUG_COW + ((XPVIV*) SvANY(sv_dat))->xiv_iv++; +#else + SvIVX(sv_dat)++; +#endif } } else { (void)SvUPGRADE(sv_dat,SVt_PVNV); sv_setpvn(sv_dat, (char *)&(RExC_npar), sizeof(I32)); SvIOK_on(sv_dat); - SvIVX(sv_dat)= 1; + SvIV_set(sv_dat, 1); } #ifdef DEBUGGING if (!av_store(RExC_paren_name_list, RExC_npar, SvREFCNT_inc(svname))) diff --git a/sv.h b/sv.h index 615e9c2..65e6ec4 100644 --- a/sv.h +++ b/sv.h @@ -1232,7 +1232,7 @@ the scalar's value cannot change unless written to. (((XPV*) SvANY(sv))->xpv_len = (val)); } STMT_END #define SvEND_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - (SvCUR(sv) = (val) - SvPVX(sv)); } STMT_END + SvCUR_set(sv, (val) - SvPVX(sv)); } STMT_END #define SvPV_renew(sv,n) \ STMT_START { SvLEN_set(sv, n); \