From c2f200920f04dba0874c054038770a91a71fbba5 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 7 Jan 2003 13:22:28 +0000 Subject: use "if any" instead of "if grep", and various other occurences of "any", "every", "partition" --- perl-install/diskdrake/hd_gtk.pm | 2 +- perl-install/diskdrake/interactive.pm | 7 +++---- perl-install/diskdrake/smbnfs_gtk.pm | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'perl-install/diskdrake') diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 41df6a5f9..f065eac0f 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -246,7 +246,7 @@ sub create_automatic_notebooks { }; $may_add->(hd2kind($_)) foreach @{$all_hds->{hds}}; $may_add->(lvm2kind($_)) foreach @{$all_hds->{lvms}}; - $may_add->(raid2kind()) if grep { $_ } @{$all_hds->{raids}}; + $may_add->(raid2kind()) if any { $_ } @{$all_hds->{raids}}; $may_add->(loopback2kind()) if @{$all_hds->{loopbacks}}; @notebook = grep_index { diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index e3055ca2a..04215eb07 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -798,9 +798,8 @@ sub RemoveFromLVM { my ($_in, $_hd, $part, $all_hds) = @_; my $lvms = $all_hds->{lvms}; isPartOfLVM($part) or die; - my ($lvm) = grep { $_->{VG_name} eq $part->{lvm} } @$lvms; - lvm::vg_destroy($lvm); - @$lvms = grep { $_ != $lvm } @$lvms; + (my $lvm, $lvms) = partition { $_->{VG_name} eq $part->{lvm} } @$lvms; + lvm::vg_destroy($lvm->[0]); } sub ModifyRAID { my ($in, $_hd, $part, $all_hds) = @_; @@ -920,7 +919,7 @@ sub Options { sub is_part_existing { my ($part, $all_hds) = @_; - $part && grep { fsedit::is_same_part($part, $_) } fsedit::get_all_fstab_and_holes($all_hds); + $part && any { fsedit::is_same_part($part, $_) } fsedit::get_all_fstab_and_holes($all_hds); } sub modifyRAID { diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index 7bf184afe..8a8feb8d3 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -119,7 +119,7 @@ sub find_fstab_entry { my $fs_entry = $kind->to_fstab_entry($e); - if (my ($fs_entry_) = grep { $fs_entry->{device} eq $_->{device} } @{$kind->{val}}) { + if (my $fs_entry_ = find { $fs_entry->{device} eq $_->{device} } @{$kind->{val}}) { $fs_entry_; } elsif ($add_or_not) { push @{$kind->{val}}, $fs_entry; -- cgit v1.2.1