From 73e6c13cf3d137e8dbc1b6a2d2552847444090a2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 23 Oct 2012 23:52:08 +0000 Subject: simplify returns --- find-lang.pl | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/find-lang.pl b/find-lang.pl index 5b0065c..995b1d7 100755 --- a/find-lang.pl +++ b/find-lang.pl @@ -38,49 +38,37 @@ File::Find::find( -f $File::Find::name or -l $File::Find::name or return; debug("next file is %s", $file); if ($file =~ m!^((.*/share/locale)/([^/@]+)[^/]*).*/([^/]+)\.mo!) { - if ($withoutmo) { - return; - } + return if $withoutmo; my ($pkg, $lang) = ($4, $3); if (pkg_match($pkg)) { own_file($file, $lang); } } elsif ($file =~ m!^((.*/gnome/help)/([^/]+)/([^/]+))!) { - if (!$withgnome) { - return; - } + return if !$withgnome; my ($pkg, $lang, $langfile) = ($3, $4, $1); if (pkg_match($pkg)) { parent_to_own($langfile, $file, $lang); } } elsif ($file =~ m!^((.*/share/help)/([^/]+)/([^/]+))/([^/]+)!) { - if (!$withhelp) { - return; - } + return if !$withhelp; my ($pkg, $lang, $langfile) = ($4, $3, $1); if (pkg_match($pkg)) { parent_to_own($langfile, $file, $lang); } } elsif ($file =~ m!^((.*/doc/kde)/HTML/([^/@]+)[^/]*)/([^/]+)/!) { - if (!$withkde) { - return; - } + return if !$withkde; my ($pkg, $lang, $langfile) = ($4, $3, $1); if (pkg_match($pkg)) { parent_to_own($langfile, $file, $lang); } } elsif ($file =~ m!^((.*/doc)/HTML/([^/@]+)[^/]*)/([^/_]+)!) { - if (!$withhtml) { - return; - } + return if !$withhtml; my ($pkg, $lang, $langfile) = ($4, $3, $1); if (pkg_match($pkg)) { parent_to_own($langfile, $file, $lang); } } elsif ($file =~ m!^((/+usr/share/man)/([^/@.]+)[^/]*)/man[^/]+/([^/.]+)\.\d[^/]*!) { - if (!$withman) { - return; - } + return if !$withman; my ($pkg, $lang, $langfile) = ($4, $3, $1); $file =~ s/\.[^\.]+$//; $file .= '.*'; @@ -117,9 +105,7 @@ exit(0); sub pkg_match { my ($pkg) = @_; return 1 if $allname; - if (grep { $_ eq $pkg } @searchname) { - return 1; - } + return 1 if grep { $_ eq $pkg } @searchname; return; } -- cgit v1.2.1