This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor the macro FT_RETURN_TRUE() into the function S_ft_return_true()
authorNicholas Clark <nick@ccl4.org>
Fri, 27 Jul 2012 12:47:56 +0000 (14:47 +0200)
committerNicholas Clark <nick@ccl4.org>
Sat, 28 Jul 2012 07:56:58 +0000 (09:56 +0200)
This makes the true and false code paths as similar as possible. It also
eliminates a macro that the HP compiler was choking on.

pp_sys.c

index e7163ac..667715a 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2928,18 +2928,18 @@ S_ft_return_false(pTHX_ SV *ret) {
 #define FT_RETURN_FALSE(X)                          \
     return S_ft_return_false(aTHX_ X)
 #define FT_RETURN_TRUE(X)                                               \
-    STMT_START {                                                        \
-        dSP;                                                            \
-        (void)(                                                         \
-            PL_op->op_flags & OPf_REF                                   \
-           ? (bool)XPUSHs(                                             \
-               PL_op->op_private & OPpFT_STACKING ? (SV *)cGVOP_gv : (X) \
-                )                                                       \
-           : (PL_op->op_private & OPpFT_STACKING || SETs(X))           \
-            );                                                          \
-        PUTBACK;                                                        \
-        return NORMAL;                                                  \
-    } STMT_END
+    return S_ft_return_true(aTHX_ X)
+
+PERL_STATIC_INLINE OP *
+S_ft_return_true(pTHX_ SV *ret) {
+    dSP;
+    if (PL_op->op_flags & OPf_REF)
+        XPUSHs(PL_op->op_private & OPpFT_STACKING ? (SV *)cGVOP_gv : (ret));
+    else if (!(PL_op->op_private & OPpFT_STACKING))
+        SETs(ret);
+    PUTBACK;
+    return NORMAL;
+}
 
 #define FT_RETURNNO    FT_RETURN_FALSE(&PL_sv_no)
 #define FT_RETURNUNDEF FT_RETURN_FALSE(&PL_sv_undef)