summaryrefslogtreecommitdiff
path: root/sv.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 /sv.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 'sv.h')
-rw-r--r--sv.h40
1 files changed, 4 insertions, 36 deletions
diff --git a/sv.h b/sv.h
index ef2b1ae5f2..970d03e85d 100644
--- a/sv.h
+++ b/sv.h
@@ -224,42 +224,10 @@ perform the upgrade if necessary. See C<svtype>.
#define SvFLAGS(sv) (sv)->sv_flags
#define SvREFCNT(sv) (sv)->sv_refcnt
-#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
-# define SvREFCNT_inc(sv) \
- ({ \
- SV * const _sv = MUTABLE_SV(sv); \
- if (_sv) \
- (SvREFCNT(_sv))++; \
- _sv; \
- })
-# define SvREFCNT_inc_simple(sv) \
- ({ \
- if (sv) \
- (SvREFCNT(sv))++; \
- MUTABLE_SV(sv); \
- })
-# define SvREFCNT_inc_NN(sv) \
- ({ \
- SV * const _sv = MUTABLE_SV(sv); \
- SvREFCNT(_sv)++; \
- _sv; \
- })
-# define SvREFCNT_inc_void(sv) \
- ({ \
- SV * const _sv = MUTABLE_SV(sv); \
- if (_sv) \
- (void)(SvREFCNT(_sv)++); \
- })
-#else
-# define SvREFCNT_inc(sv) \
- ((PL_Sv=MUTABLE_SV(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL)
-# define SvREFCNT_inc_simple(sv) \
- ((sv) ? (SvREFCNT(sv)++,MUTABLE_SV(sv)) : NULL)
-# define SvREFCNT_inc_NN(sv) \
- (PL_Sv=MUTABLE_SV(sv),++(SvREFCNT(PL_Sv)),PL_Sv)
-# define SvREFCNT_inc_void(sv) \
- (void)((PL_Sv=MUTABLE_SV(sv)) ? ++(SvREFCNT(PL_Sv)) : 0)
-#endif
+#define SvREFCNT_inc(sv) S_SvREFCNT_inc(MUTABLE_SV(sv))
+#define SvREFCNT_inc_simple(sv) SvREFCNT_inc(sv)
+#define SvREFCNT_inc_NN(sv) S_SvREFCNT_inc_NN(MUTABLE_SV(sv))
+#define SvREFCNT_inc_void(sv) S_SvREFCNT_inc_void(MUTABLE_SV(sv))
/* These guys don't need the curly blocks */
#define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END