summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-18 12:34:33 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-21 16:38:35 -0700
commit27669aa412f62d9967b069ba672cd20239c354c1 (patch)
tree237c8ecdec51bac13edf069951da5a2afcbfdfc1 /inline.h
parent25468daabce05c6c76ace4055995f92d166fc9ff (diff)
downloadperl-27669aa412f62d9967b069ba672cd20239c354c1.tar.gz
Use static inline functions for SvREFCNT_inc
This avoids the need to repeat the macros in GCC and non-GCC versions. For non-GCC compilers capable of inlining, this should speed things up slightly, too, as PL_Sv is no longer needed.
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/inline.h b/inline.h
index 608f6c4b2a..cdcaf04a8f 100644
--- a/inline.h
+++ b/inline.h
@@ -11,3 +11,25 @@
*
* Each section names the header file that the functions "belong" to.
*/
+
+/* ------------------------------- sv.h ------------------------------- */
+
+PERL_STATIC_INLINE SV *
+S_SvREFCNT_inc(SV *sv)
+{
+ if (sv)
+ SvREFCNT(sv)++;
+ return sv;
+}
+PERL_STATIC_INLINE SV *
+S_SvREFCNT_inc_NN(SV *sv)
+{
+ SvREFCNT(sv)++;
+ return sv;
+}
+PERL_STATIC_INLINE void
+S_SvREFCNT_inc_void(SV *sv)
+{
+ if (sv)
+ SvREFCNT(sv)++;
+}