regcomp.c: Combine expression into a macro
authorKarl Williamson <khw@cpan.org>
Sun, 14 Oct 2018 19:56:21 +0000 (13:56 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 20 Oct 2018 06:09:55 +0000 (00:09 -0600)
This expression will change in a future commit, so this isolates that
change

regcomp.c

index 5cb71ff..528b690 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -284,6 +284,7 @@ struct RExC_state_t {
 #define RExC_study_started      (pRExC_state->study_started)
 #define RExC_warn_text (pRExC_state->warn_text)
 #define RExC_in_script_run      (pRExC_state->in_script_run)
+#define RExC_use_BRANCHJ        (!SIZE_ONLY && RExC_extralen)
 
 /* Heuristic check on the complexity of the pattern: if TOO_NAUGHTY, we set
  * a flag to disable back-off on the fixed/floating substrings - if it's
@@ -11756,7 +11757,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
         FAIL2("panic: regbranch returned failure, flags=%#" UVxf, (UV) flags);
     }
     if (*RExC_parse == '|') {
-       if (!SIZE_ONLY && RExC_extralen) {
+       if (RExC_use_BRANCHJ) {
            reginsert(pRExC_state, BRANCHJ, br, depth+1);
        }
        else {                  /* MJD */
@@ -11779,7 +11780,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
     *flagp |= flags & (SPSTART | HASWIDTH | POSTPONED);
     lastbr = br;
     while (*RExC_parse == '|') {
-       if (!SIZE_ONLY && RExC_extralen) {
+       if (RExC_use_BRANCHJ) {
            ender = reganode(pRExC_state, LONGJMP, 0);
 
             /* Append to the previous. */
@@ -12018,7 +12019,7 @@ S_regbranch(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, I32 first, U32 depth)
     if (first)
        ret = 0;
     else {
-       if (!SIZE_ONLY && RExC_extralen)
+       if (RExC_use_BRANCHJ)
            ret = reganode(pRExC_state, BRANCHJ, 0);
        else {
            ret = reg_node(pRExC_state, BRANCH);
@@ -12205,7 +12206,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
 
                FLAGS(REGNODE_p(w)) = 0;
                 REGTAIL(pRExC_state, ret, w);
-               if (!SIZE_ONLY && RExC_extralen) {
+               if (RExC_use_BRANCHJ) {
                    reginsert(pRExC_state, LONGJMP, ret, depth+1);
                    reginsert(pRExC_state, NOTHING, ret, depth+1);
                    NEXT_OFF(REGNODE_p(ret)) = 3;       /* Go over LONGJMP. */
@@ -12216,7 +12217,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
                 Set_Node_Length(REGNODE_p(ret),
                                 op == '{' ? (RExC_parse - parse_start) : 1);
 
-               if (!SIZE_ONLY && RExC_extralen)
+               if (RExC_use_BRANCHJ)
                     NEXT_OFF(REGNODE_p(ret)) = 3;   /* Go over NOTHING to
                                                        LONGJMP. */
                 REGTAIL(pRExC_state, ret, reg_node(pRExC_state, NOTHING));