commit:     6b58eecc5b34941e2ffe1626df950d92d33d2617
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jan 11 13:44:00 2026 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Jan 11 13:44:00 2026 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6b58eecc

Shorten a few lines of code

One in the parse_config() subroutine and another in the fopen()
subroutine.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/locale-gen b/locale-gen
index 4b79b99..91caa81 100644
--- a/locale-gen
+++ b/locale-gen
@@ -378,9 +378,9 @@ sub parse_config ($fh, $path, $supported_by, $be_strict) {
                # first defines the localename. The second defines the charmap.
                # If the second field is missing, a value of "UTF-8" is assumed.
                # The <slash> character is forbidden in both fields.
-               my @fields;
+               my @fields = split /\h+/, trim_line($line), 3;
                my ($locale, $charmap);
-               if (0 < (@fields = split /\h+/, trim_line($line), 3) < 3 && ! 
grep +( m/\// ), @fields) {
+               if (0 < @fields < 3 && ! grep +( m/\// ), @fields) {
                        ($locale, $charmap) = ($fields[0], $fields[1] // 
'UTF-8');
                } else {
                        invalidate('Malformed locale declaration', 1);
@@ -656,7 +656,7 @@ sub copy_security_context ($src_path, $dst_path) {
 sub fopen ($path) {
        if (! open my $fh, '<', $path) {
                die "$PROGRAM: Can't open '$path': $!\n";
-       } elsif (! -f $fh && none(sub { is_eq_file($path, $_) }, '/dev/null', 
'/dev/stdin')) {
+       } elsif (! -f $fh && none(sub { is_eq_file($path, "/dev/$_") }, 'null', 
'stdin')) {
                die "$PROGRAM: Won't open '$path' because it is not a regular 
file\n";
        } else {
                return $fh;

Reply via email to