Skip to content

Commit

Permalink
regcomp.c: Use existing function to do task
Browse files Browse the repository at this point in the history
The function does it better than this code, which looked too deeply into
the internals, and got it wrong sometimes, because it didn't look at the
state of the inversion.  The consequences are not a bug, but potentially
forgoing an optimization, or needlessly looking for an optimization that
will turn out to not be there.
  • Loading branch information
khwilliamson committed Jan 25, 2018
1 parent a1bb8e7 commit e5393ec
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions regcomp.c
Expand Up @@ -18100,8 +18100,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
invlist_iterfinish(cp_list);

if (op == END) {
const UV cp_list_len = _invlist_len(cp_list);
const UV* cp_list_array = invlist_array(cp_list);

/* Here, didn't find an optimization. See if this matches any of
* the POSIX classes. First try ASCII */
Expand All @@ -18114,7 +18112,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
op = NASCII;
*flagp |= HASWIDTH|SIMPLE;
}
else if (cp_list_array[cp_list_len-1] >= 0x2029) {
else if (invlist_highest(cp_list) >= 0x2029) {

/* Then try the other POSIX classes. The POSIXA ones are about
* the same speed as ANYOF ops, but the ones that have
Expand Down

0 comments on commit e5393ec

Please sign in to comment.