pp_match(): minor refactor: consolidate RETPUSHYES
authorDavid Mitchell <davem@iabyn.com>
Sun, 16 Jun 2013 14:38:56 +0000 (15:38 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 28 Jul 2013 09:33:35 +0000 (10:33 +0100)
Make the code slightly simpler by doing an early RETPUSHYES after success
where possible.

pp_hot.c

index ca2dfc4..974558a 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1477,7 +1477,12 @@ PP(pp_match)
         }
     }
 
-    if (gimme == G_ARRAY) {
+    if ((!RX_NPARENS(rx) && !global) || gimme != G_ARRAY) {
+       LEAVE_SCOPE(oldsave);
+       RETPUSHYES;
+    }
+
+    {
        const I32 nparens = RX_NPARENS(rx);
        I32 i = (global && !nparens) ? 1 : 0;
 
@@ -1508,15 +1513,9 @@ PP(pp_match)
            r_flags |= REXEC_IGNOREPOS | REXEC_NOT_FIRST;
            goto play_it_again;
        }
-       else if (!nparens)
-           XPUSHs(&PL_sv_yes);
        LEAVE_SCOPE(oldsave);
        RETURN;
     }
-    else {
-       LEAVE_SCOPE(oldsave);
-       RETPUSHYES;
-    }
 
 yup:                                   /* Confirmed by INTUIT */
     assert(!RX_NPARENS(rx));