summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-18 12:58:38 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-21 16:38:35 -0700
commit541377b1bd73cdee43dd47958251827cfdc59320 (patch)
treef41b9042edd1e71110e72d7568da6c560db3a3d7 /inline.h
parent75e16a44f58a9b54834e043a988a36289179c4ab (diff)
downloadperl-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.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/inline.h b/inline.h
index 798b493e21..eee1097b1e 100644
--- a/inline.h
+++ b/inline.h
@@ -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;
+}