summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorTim Retout <tim@retout.co.uk>2012-02-15 19:55:46 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-02-16 13:46:12 +0000
commit94c1836fb5e2028a237d5104115090c81667e1db (patch)
treeb40bc5360dd2789f560eb8dda0572197d30ccefe /solenv
parent14e6a83cc53438a360656449c8c5da41d46f9d87 (diff)
Inline and simplify installer::sorter::sort_array_of_hashes_numerically.
Diffstat (limited to 'solenv')
-rw-r--r--solenv/bin/modules/installer/sorter.pm30
-rw-r--r--solenv/bin/modules/installer/windows/feature.pm13
2 files changed, 5 insertions, 38 deletions
diff --git a/solenv/bin/modules/installer/sorter.pm b/solenv/bin/modules/installer/sorter.pm
index b61bb5b32593..91ed9aed0b5f 100644
--- a/solenv/bin/modules/installer/sorter.pm
+++ b/solenv/bin/modules/installer/sorter.pm
@@ -60,34 +60,4 @@ sub sorting_array_of_hashes
}
}
-######################################################
-# Sorting an array of hashes with a numerical value
-######################################################
-
-sub sort_array_of_hashes_numerically
-{
- my ($arrayref, $sortkey) = @_;
-
- for ( my $i = 0; $i <= $#{$arrayref}; $i++ )
- {
- my $onehashunder = ${$arrayref}[$i];
- my $sortvalueunder = $onehashunder->{$sortkey};
-
- for ( my $j = $i + 1; $j <= $#{$arrayref}; $j++ )
- {
- my $onehashover = ${$arrayref}[$j];
- my $sortvalueover = $onehashover->{$sortkey};
-
- if ( $sortvalueunder > $sortvalueover)
- {
- ${$arrayref}[$i] = $onehashover;
- ${$arrayref}[$j] = $onehashunder;
-
- $onehashunder = $onehashover;
- $sortvalueunder = $sortvalueover;
- }
- }
- }
-}
-
1;
diff --git a/solenv/bin/modules/installer/windows/feature.pm b/solenv/bin/modules/installer/windows/feature.pm
index d570ec017518..92d8cfee8abe 100644
--- a/solenv/bin/modules/installer/windows/feature.pm
+++ b/solenv/bin/modules/installer/windows/feature.pm
@@ -31,7 +31,6 @@ use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
-use installer::sorter;
use installer::worker;
use installer::windows::idtglobal;
use installer::windows::language;
@@ -244,8 +243,7 @@ sub collect_modules_recursive
{
if ( $directparent->{$modulegid} eq $parentid )
{
- my %childhash = ( "gid" => "$modulegid", "Sortkey" => "$directsortkey->{$modulegid}");
- push(@allchildren, \%childhash);
+ push @allchildren, [ $directsortkey->{$modulegid}, $modulegid ];
$childrenexist = 1;
}
}
@@ -255,14 +253,13 @@ sub collect_modules_recursive
if ( $childrenexist )
{
# Sort children
- installer::sorter::sort_array_of_hashes_numerically(\@allchildren, "Sortkey");
+ @allchildren = map { $_->[1] }
+ sort { $a->[0] <=> $b->[0] }
+ @allchildren;
# Adding children to new array
- my $childhashref;
- foreach $childhashref ( @allchildren )
+ foreach my $gid ( @allchildren )
{
- my $gid = $childhashref->{'gid'};
-
# Saving all lines, that have this 'gid'
my $unique;