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 Aug 7, 2021
1 parent f65d7dd commit e145861
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions regcomp.c
Expand Up @@ -19326,7 +19326,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 @@ -19360,6 +19360,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 @@ -19824,7 +19826,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 e145861

Please sign in to comment.