diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-04-19 20:07:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-04-19 20:07:49 +0000 |
commit | 62703e7218aceb3f5d30f70a2307dd02e5eb8c63 (patch) | |
tree | 13f0830b3ad56b67739da5155d1f69020c98aee5 /sv.h | |
parent | bd7d4f4d586a396d1b104a293cce339c8d63ce5a (diff) | |
download | perl-62703e7218aceb3f5d30f70a2307dd02e5eb8c63.tar.gz |
Force RVALUE macros when in PERL_DEBUG_COW
p4raw-id: //depot/perl@24252
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 51 |
1 files changed, 31 insertions, 20 deletions
@@ -742,29 +742,30 @@ in gv.h: */ #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 + ((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)) +#define SvIVX(sv) (0 + ((XPVIV*) SvANY(sv))->xiv_iv) +#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) (((XPV*) SvANY(sv))->xpv_pv + ((XPV*)SvANY(sv))->xpv_cur) + +#ifdef PERL_IN_SV_C +/* Can't make this RVALUE because of Perl_sv_unmagic. */ +#define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) #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 -#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) +#define SvMAGIC(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) #endif +#define SvSTASH(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_stash)) -#define SvIVXx(sv) SvIVX(sv) -#define SvUVXx(sv) SvUVX(sv) -#define SvNVXx(sv) SvNVX(sv) -#define SvPVXx(sv) SvPVX(sv) -#define SvLENx(sv) SvLEN(sv) -#define SvENDx(sv) ((PL_Sv = (sv)), SvEND(PL_Sv)) +#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 +#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) #ifdef DEBUGGING #define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) @@ -774,6 +775,16 @@ in gv.h: */ #define SvSTASH(sv) ((XPVMG*) SvANY(sv))->xmg_stash #endif +#endif + +#define SvIVXx(sv) SvIVX(sv) +#define SvUVXx(sv) SvUVX(sv) +#define SvNVXx(sv) SvNVX(sv) +#define SvPVXx(sv) SvPVX(sv) +#define SvLENx(sv) SvLEN(sv) +#define SvENDx(sv) ((PL_Sv = (sv)), SvEND(PL_Sv)) + + /* Ask a scalar nicely to try to become an IV, if possible. Not guaranteed to stay returning void */ /* Macro won't actually call sv_2iv if already IOK */ |