This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use fast SvREFCNT_dec for non-GCC
authorFather Chrysostomos <sprout@cpan.org>
Sat, 18 Aug 2012 19:39:40 +0000 (12:39 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 21 Aug 2012 23:38:35 +0000 (16:38 -0700)
inline.h
sv.h

index cdcaf04..798b493 100644 (file)
--- a/inline.h
+++ b/inline.h
@@ -33,3 +33,15 @@ S_SvREFCNT_inc_void(SV *sv)
     if (sv)
        SvREFCNT(sv)++;
 }
+PERL_STATIC_INLINE void
+S_SvREFCNT_dec(pTHX_ SV *sv)
+{
+    if (sv) {
+       if (SvREFCNT(sv)) {
+           if (--(SvREFCNT(sv)) == 0)
+               Perl_sv_free2(aTHX_ sv);
+       } else {
+           sv_free(sv);
+       }
+    }
+}
diff --git a/sv.h b/sv.h
index 970d03e..ab0a0fd 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -235,22 +235,7 @@ perform the upgrade if necessary.  See C<svtype>.
 #define SvREFCNT_inc_void_NN(sv)       (void)(++SvREFCNT(MUTABLE_SV(sv)))
 #define SvREFCNT_inc_simple_void_NN(sv)        (void)(++SvREFCNT(MUTABLE_SV(sv)))
 
-#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
-#  define SvREFCNT_dec(sv)             \
-    ({                                 \
-       SV * const _sv = MUTABLE_SV(sv);        \
-       if (_sv) {                      \
-           if (SvREFCNT(_sv)) {        \
-               if (--(SvREFCNT(_sv)) == 0) \
-                   Perl_sv_free2(aTHX_ _sv);   \
-           } else {                    \
-               sv_free(_sv);           \
-           }                           \
-       }                               \
-    })
-#else
-#define SvREFCNT_dec(sv)       sv_free(MUTABLE_SV(sv))
-#endif
+#define SvREFCNT_dec(sv)       S_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv))
 
 #define SVTYPEMASK     0xff
 #define SvTYPE(sv)     ((svtype)((sv)->sv_flags & SVTYPEMASK))