diff options
author | Karl Williamson <khw@cpan.org> | 2020-03-29 12:42:52 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-10-16 07:01:41 -0600 |
commit | e272994f04d07d5d7e5aecfa9e38a75f253ae5ce (patch) | |
tree | 6d3c172bfa1c665d1ec5ba15178a06887d43564b /regen | |
parent | 8c112bb9153a54e615913d6c26876fb488703762 (diff) | |
download | perl-e272994f04d07d5d7e5aecfa9e38a75f253ae5ce.tar.gz |
regen/regcharclass.pl: Move parameter to caller
This commit changes a sub in this file to be passed a new parameter.
This is in preparation for the value to be used in the caller. No need
to derive it twice.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/regcharclass.pl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 2ce2135cff..e6dc0f7434 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -166,13 +166,13 @@ License or the Artistic License, as specified in the README file. # sub __uni_latin1 { - my $charset= shift; + my $charset = shift; + my $a2n= shift; my $str= shift; my $max= 0; my @cp; my @cp_high; my $only_has_invariants = 1; - my $a2n = get_a2n($charset); for my $ch ( split //, $str ) { my $cp= ord $ch; $max= $cp if $max < $cp; @@ -352,6 +352,10 @@ sub new { op => $opt{op}, title => $opt{title} || '', }, $class; + + my $charset = $opt{charset}; + my $a2n = get_a2n($charset); + foreach my $txt ( @{ $opt{txt} } ) { my $str= $txt; if ( $str =~ /^[""]/ ) { @@ -405,7 +409,7 @@ sub new { } else { die "Unparsable line: $txt\n"; } - my ( $cp, $cp_high, $low, $latin1, $utf8 )= __uni_latin1( $opt{charset}, $str ); + my ( $cp, $cp_high, $low, $latin1, $utf8 )= __uni_latin1($charset, $a2n, $str ); my $UTF8= $low || $utf8; my $LATIN1= $low || $latin1; my $high = (scalar grep { $_ < 256 } @$cp) ? 0 : $utf8; |