commit: 4384b2f9d44b594074cb3a5e53fa1395bf22da84
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Oct 27 21:31:24 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Oct 27 21:36:11 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4384b2f9
Jettison the @fields variable from parse_config()
Given the latterly diminished responsibility of the parse_entry()
subroutine, there is no particular reason to continue reading the fields
of each locale.gen(5) record into a temporary array.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index af67d75..8b152b7 100644
--- a/locale-gen
+++ b/locale-gen
@@ -337,9 +337,9 @@ sub parse_config ($fh, $path, $supported_by) {
$line =~ s/\h\K#\h.*//;
# Expect for two fields, separated by horizontal whitespace.
- my @fields;
+ my ($locale, $charmap);
chomp $line;
- if (2 != (@fields = split /\h+/, trim_line($line), 3)) {
+ if (2 != (($locale, $charmap) = split /\h+/, trim_line($line)))
{
$thrower->('Malformed locale declaration', $line);
}
@@ -349,12 +349,12 @@ sub parse_config ($fh, $path, $supported_by) {
# amend their config files before eventually dropping support
# for "UTF8" altogether.
my @warnings;
- if ($fields[0] =~ s/\.UTF\K8(?=@|\z)/-8/) {
+ if ($locale =~ s/\.UTF\K8(?=@|\z)/-8/) {
push @warnings,
sprintf "WARNING! Codeset specified as UTF8
(should be UTF-8) at %s[%d]: %s",
$path, $., render_printable($line);
}
- if ($fields[1] =~ s/^UTF8\z/UTF-8/) {
+ if ($charmap =~ s/^UTF8\z/UTF-8/) {
push @warnings,
sprintf "WARNING! Charmap specified as UTF8
(should be UTF-8) at %s[%d]: %s",
$path, $., render_printable($line);
@@ -369,7 +369,6 @@ sub parse_config ($fh, $path, $supported_by) {
}
# Validate both locale and character map before accepting.
- my ($locale, $charmap) = @fields;
if (! $supported_by->{$locale}) {
$thrower->('Invalid locale', $line);
} elsif (! $supported_by->{''}{$charmap}) {