Skip to content

Commit

Permalink
regcomp.c: Save a value instead of re-calling fcn
Browse files Browse the repository at this point in the history
This variable will be used in future commits in more places, so compute
it just once.
  • Loading branch information
khwilliamson committed Jun 2, 2021
1 parent d070adf commit 1402c65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions regcomp.c
Expand Up @@ -19325,7 +19325,7 @@ S_optimize_regclass(pTHX_
UV start[MAX_FOLD_FROMS+1] = { 0 }; /* +1 for the folded-to char */
UV end[MAX_FOLD_FROMS+1] = { 0 };
bool single_range = FALSE;
UV lowest_cp = 0;
UV lowest_cp = 0, highest_cp = 0;

PERL_ARGS_ASSERT_OPTIMIZE_REGCLASS;

Expand Down Expand Up @@ -19359,6 +19359,8 @@ S_optimize_regclass(pTHX_

/* Use a clearer mnemonic for below */
lowest_cp = start[0];

highest_cp = invlist_highest(cp_list);
}

/* Similarly, for /l posix classes, if both a class and its complement
Expand Down Expand Up @@ -19831,7 +19833,7 @@ S_optimize_regclass(pTHX_
/* If doesn't fit the criteria for ANYOFM, invert and try again. If
* that works we will instead later generate an NANYOFM, and invert
* back when through */
if (invlist_highest(cp_list) > max_permissible) {
if (highest_cp > max_permissible) {
_invlist_invert(cp_list);
inverted = 1;
}
Expand Down

0 comments on commit 1402c65

Please sign in to comment.