From: Nicholas Clark Date: Fri, 8 Apr 2005 13:16:07 +0000 (+0000) Subject: Add SvIVX() to PERL_DEBUG_COW, and change pad.c to SvIVset() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b19bbeda6b26f3e23a2972d1e2954d2ad559f3eb;p=p5sagit%2Fp5-mst-13.2.git Add SvIVX() to PERL_DEBUG_COW, and change pad.c to SvIVset() p4raw-id: //depot/perl@24206 --- diff --git a/pad.c b/pad.c index f58d8b9..e73f750 100644 --- a/pad.c +++ b/pad.c @@ -353,7 +353,7 @@ Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake else { /* not yet introduced */ SvNV_set(namesv, (NV)PAD_MAX); /* min */ - SvIVX(namesv) = 0; /* max */ + SvIV_set(namesv, 0); /* max */ if (!PL_min_intro_pending) PL_min_intro_pending = offset; @@ -458,7 +458,7 @@ Perl_pad_add_anon(pTHX_ SV* sv, OPCODE op_type) name = NEWSV(1106, 0); sv_upgrade(name, SVt_PVNV); sv_setpvn(name, "&", 1); - SvIVX(name) = -1; + SvIV_set(name, -1); SvNV_set(name, 1); ix = pad_alloc(op_type, SVs_PADMY); av_store(PL_comppad_name, ix, name); @@ -822,7 +822,7 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, ); new_namesv = AvARRAY(PL_comppad_name)[new_offset]; - SvIVX(new_namesv) = *out_flags; + SvIV_set(new_namesv, *out_flags); SvNV_set(new_namesv, (NV)0); if (SvFLAGS(new_namesv) & SVpad_OUR) { @@ -959,7 +959,7 @@ Perl_intro_my(pTHX) if ((sv = svp[i]) && sv != &PL_sv_undef && !SvFAKE(sv) && !SvIVX(sv)) { - SvIVX(sv) = PAD_MAX; /* Don't know scope end yet. */ + SvIV_set(sv, PAD_MAX); /* Don't know scope end yet. */ SvNV_set(sv, (NV)PL_cop_seqmax); DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad intromy: %ld \"%s\", (%ld,%ld)\n", @@ -1009,7 +1009,7 @@ Perl_pad_leavemy(pTHX) if ((sv = svp[off]) && sv != &PL_sv_undef && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX) { - SvIVX(sv) = PL_cop_seqmax; + SvIV_set(sv, PL_cop_seqmax); DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad leavemy: %ld \"%s\", (%ld,%ld)\n", (long)off, SvPVX(sv), diff --git a/sv.h b/sv.h index 5e0c45e..90c62aa 100644 --- a/sv.h +++ b/sv.h @@ -736,12 +736,14 @@ in gv.h: */ #define SvRV(sv) ((XRV*) SvANY(sv))->xrv_rv #define SvRVx(sv) SvRV(sv) -#define SvIVX(sv) ((XPVIV*) SvANY(sv))->xiv_iv -#define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv #ifdef PERL_DEBUG_COW -#define SvNVX(sv) (0.0 + ((XPVNV*)SvANY(sv))->xnv_nv) +#define SvIVX(sv) (0 + ((XPVIV*) SvANY(sv))->xiv_iv) +#define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv +#define SvNVX(sv) (0.0 + ((XPVNV*)SvANY(sv))->xnv_nv) #else -#define SvNVX(sv) ((XPVNV*)SvANY(sv))->xnv_nv +#define SvIVX(sv) ((XPVIV*) SvANY(sv))->xiv_iv +#define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv +#define SvNVX(sv) ((XPVNV*)SvANY(sv))->xnv_nv #endif #define SvPVX(sv) ((XPV*) SvANY(sv))->xpv_pv #define SvCUR(sv) ((XPV*) SvANY(sv))->xpv_cur @@ -771,7 +773,7 @@ in gv.h: */ (void) SvIV(sv); } STMT_END #define SvIV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ - (SvIVX(sv) = (val)); } STMT_END + (((XPVIV*) SvANY(sv))->xiv_iv = (val)); } STMT_END #define SvNV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_NV || SvTYPE(sv) >= SVt_PVNV); \ (((XPVNV*)SvANY(sv))->xnv_nv = (val)); } STMT_END