gitweb: Use block form of map/grep in a few cases more
Use block form of 'grep' i.e. 'grep {BLOCK} LIST' rather than 'grep(EXPR, LIST)' in filter_snapshot_fmts subroutine. This makes code more readable, as expression is rather long, and statement above there is 'map' with very similar expression also in the block form. Remove unnecessary and misleading parentheses around block form 'map' arguments in quote_command subroutine. The inner "map" in format_snapshot_links was left alone, as it is not clear whether adding parentheses or changing it into block form would improve readibility and clarity of this code. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
May 10, 2009 at 02:40 UTC
68cedb1fea0bbcd5f7c32ce10e3c346bc6db38c5
1 file changed
+3
-3
gitweb/gitweb.perl
+3
-3
@@ -458,8 +458,8 @@ sub filter_snapshot_fmts {
458
@fmts = map {
459
exists $known_snapshot_format_aliases{$_} ?
460
$known_snapshot_format_aliases{$_} : $_} @fmts;
461
- @fmts = grep(exists $known_snapshot_formats{$_}, @fmts);
462
-
461
+ @fmts = grep {
462
+ exists $known_snapshot_formats{$_} } @fmts;
463
}
464
465
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
@@ -1838,7 +1838,7 @@ sub git_cmd {
1838
# Try to avoid using this function wherever possible.
1839
sub quote_command {
1840
return join(' ',
1841
- map( { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ ));
1841
+ map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
1842
}
1843
1844
# get HEAD ref of given project as hash