Skip to content

Commit cd7579f

Browse files
committed
apt-file: Replace a loop with map
Signed-off-by: Niels Thykier <[email protected]>
1 parent 951deaa commit cd7579f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apt-file

+5-5
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ sub do_grep($$) {
305305
next if !( ( $fname, $pkgs ) = /$regexp/o );
306306

307307
debug_line ".";
308-
foreach ( split /,/, $pkgs ) {
309-
310-
# Put leading slash on file name
311-
push @{ $ret->{"/$fname"} }, basename $_;
312-
}
308+
# Put leading slash on file name
309+
push(@{ $ret->{"/$fname"} },
310+
# ... and extract the package name
311+
map { basename($_) } split(m/,/, $pkgs)
312+
);
313313
if (++$matches % 10 == 0) {
314314
tty_human_status("Searching, found $matches results so far ...");
315315
}

0 commit comments

Comments
 (0)