Skip to content

Commit

Permalink
regen/regcharclass.pl: Use deref of an array
Browse files Browse the repository at this point in the history
This will make future commits read better.
  • Loading branch information
khwilliamson committed Aug 7, 2021
1 parent 2be3206 commit cef3e2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion regcharclass.h
Expand Up @@ -3765,6 +3765,6 @@
* 696e706fddd3ce8cd48c7ea91caf4c9edf5c296432d320aa7b78631f69aa9eac lib/unicore/mktables
* 50b85a67451145545a65cea370dab8d3444fbfe07e9c34cef560c5b7da9d3eef lib/unicore/version
* 0a6b5ab33bb1026531f816efe81aea1a8ffcd34a27cbea37dd6a70a63d73c844 regen/charset_translations.pl
* 065ce7a720f2a8ce9ca452f2c057030e6bd4af360a945d3846cf27400bfc73bb regen/regcharclass.pl
* caaecefabe09ed616a050deda95a866f399770bde5f5e2158cec7ba77a8ed794 regen/regcharclass.pl
* b2f896452d2b30da3e04800f478c60c1fd0b03d6b668689b020f1e3cf1f1cdd9 regen/regcharclass_multi_char_folds.pl
* ex: set ro: */
11 changes: 6 additions & 5 deletions regen/regcharclass.pl
Expand Up @@ -1057,10 +1057,11 @@ (@)
# - merges ranges of conditions, and joins the result with ||
sub _cond_as_str {
my ( $self, $op, $combine, $opts_ref )= @_;
my $cond= $op->{vals};
my @cond = ();
@cond = $op->{vals}->@* if defined $op->{vals};
my $test= $op->{test};
my $is_cp_ret = $opts_ref->{ret_type} eq "cp";
return "( $test )" if !defined $cond;
return "( $test )" unless @cond;

# rangify the list. As we encounter a new value, it is placed in a new
# subarray by itself. If the next value is adjacent to it, the end point
Expand All @@ -1075,7 +1076,7 @@ sub _cond_as_str {
$ranges[-1] = $ranges[-1][0] if $ranges[-1][0] == $ranges[-1][1];
}
};
for my $condition ( @$cond ) {
for my $condition ( @cond ) {
if ( !@ranges || $condition != $ranges[-1][1] + 1 ) {
# Not adjacent to the existing range. Remove that from being a
# range if only a single value;
Expand All @@ -1093,7 +1094,7 @@ sub _cond_as_str {
# If the input set has certain characteristics, we can optimize tests
# for it.

return 1 if @$cond == 256; # If all bytes match, is trivially true
return 1 if @cond == 256; # If all bytes match, is trivially true

my @masks;
if (@ranges > 1) {
Expand All @@ -1102,7 +1103,7 @@ sub _cond_as_str {
# return the optimization. There is no need to do this on sets with
# just a single range, as that can be expressed with a single
# conditional.
@masks = calculate_mask(@$cond);
@masks = calculate_mask(@cond);

# Stringify the output of calculate_mask()
if (@masks) {
Expand Down

0 comments on commit cef3e2d

Please sign in to comment.