diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-18 12:58:38 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-21 16:38:35 -0700 |
commit | 541377b1bd73cdee43dd47958251827cfdc59320 (patch) | |
tree | f41b9042edd1e71110e72d7568da6c560db3a3d7 /inline.h | |
parent | 75e16a44f58a9b54834e043a988a36289179c4ab (diff) | |
download | perl-541377b1bd73cdee43dd47958251827cfdc59320.tar.gz |
Static inline functions for SvPADTMP and SvPADSTALE
This allows non-GCC compilers to have assertions and avoids
repeating the macros.
Diffstat (limited to 'inline.h')
-rw-r--r-- | inline.h | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -45,3 +45,41 @@ S_SvREFCNT_dec(pTHX_ SV *sv) } } } + +PERL_STATIC_INLINE void +SvAMAGIC_on(SV *sv) +{ + assert(SvROK(sv)); + if (SvOBJECT(SvRV(sv))) HvAMAGIC_on(SvSTASH(SvRV(sv))); +} +PERL_STATIC_INLINE void +SvAMAGIC_off(SV *sv) +{ + if (SvROK(sv) && SvOBJECT(SvRV(sv))) + HvAMAGIC_off(SvSTASH(SvRV(sv))); +} + +PERL_STATIC_INLINE U32 +S_SvPADTMP_on(SV *sv) +{ + assert(!(SvFLAGS(sv) & SVs_PADMY)); + return SvFLAGS(sv) |= SVs_PADTMP; +} +PERL_STATIC_INLINE U32 +S_SvPADTMP_off(SV *sv) +{ + assert(!(SvFLAGS(sv) & SVs_PADMY)); + return SvFLAGS(sv) &= ~SVs_PADTMP; +} +PERL_STATIC_INLINE U32 +S_SvPADSTALE_on(SV *sv) +{ + assert(SvFLAGS(sv) & SVs_PADMY); + return SvFLAGS(sv) |= SVs_PADSTALE; +} +PERL_STATIC_INLINE U32 +S_SvPADSTALE_off(SV *sv) +{ + assert(SvFLAGS(sv) & SVs_PADMY); + return SvFLAGS(sv) &= ~SVs_PADSTALE; +} |