Skip to content

Commit

Permalink
regcomp.c: Consolidate duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson authored and hvds committed Jun 1, 2021
1 parent 72c2820 commit 8ddac7f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions regcomp.c
Expand Up @@ -19336,15 +19336,11 @@ S_optimize_regclass(pTHX_
* any run-time dependencies don't matter */
if (start[0] == 0 && end[0] == UV_MAX) {
if (*invert) {
op = OPFAIL;
*ret = reganode(pRExC_state, op, 0);
goto return_OPFAIL;
}
else {
op = SANY;
*ret = reg_node(pRExC_state, op);
MARK_NAUGHTY(1);
goto return_SANY;
}
return op;
}

/* Similarly, for /l posix classes, if both a class and its complement
Expand All @@ -19356,13 +19352,10 @@ S_optimize_regclass(pTHX_
&& POSIXL_TEST(posixl, namedclass + 1)) /* its complement */
{
if (*invert) {
op = OPFAIL;
*ret = reganode(pRExC_state, op, 0);
goto return_OPFAIL;
}
else {
op = SANY;
*ret = reg_node(pRExC_state, op);
MARK_NAUGHTY(1);
goto return_SANY;
}
return op;
}
Expand Down Expand Up @@ -19446,15 +19439,11 @@ S_optimize_regclass(pTHX_
* properties). */
if (partial_cp_count == 0) {
if (*invert) {
op = SANY;
*ret = reg_node(pRExC_state, op);
goto return_SANY;
}
else {
op = OPFAIL;
*ret = reganode(pRExC_state, op, 0);
goto return_OPFAIL;
}

return op;
}

/* If matches everything but \n */
Expand Down Expand Up @@ -20170,6 +20159,17 @@ S_optimize_regclass(pTHX_
}

return op;

return_OPFAIL:
op = OPFAIL;
*ret = reganode(pRExC_state, op, 0);
return op;

return_SANY:
op = SANY;
*ret = reg_node(pRExC_state, op);
MARK_NAUGHTY(1);
return op;
}

#undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION
Expand Down

0 comments on commit 8ddac7f

Please sign in to comment.