diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-17 13:24:47 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-17 13:24:47 +0000 |
commit | 9a096292f0475414f3c80b7cd46b0c38ed50a7e4 (patch) | |
tree | a032b03b7c49e2d4b284622730d5e03ef10e8e16 | |
parent | 57cd86ef19df8f718d2b99de9c00487078ec1d15 (diff) | |
download | rpmdrake-9a096292f0475414f3c80b7cd46b0c38ed50a7e4.tar rpmdrake-9a096292f0475414f3c80b7cd46b0c38ed50a7e4.tar.gz rpmdrake-9a096292f0475414f3c80b7cd46b0c38ed50a7e4.tar.bz2 rpmdrake-9a096292f0475414f3c80b7cd46b0c38ed50a7e4.tar.xz rpmdrake-9a096292f0475414f3c80b7cd46b0c38ed50a7e4.zip |
(pkgs_provider) optimize (less copy, less dereferencing, less memory used)
-rw-r--r-- | Rpmdrake/gui.pm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index 90963552..2f35c9ae 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -526,24 +526,24 @@ sub pkgs_provider { all => [ keys %$pkgs ], ); my %tmp_filter_methods = ( - all => sub { @filtered_pkgs = keys %$pkgs }, + all => sub { [ keys %$pkgs ] }, all_updates => sub { - @filtered_pkgs = @{$h->{updates}}; # potential "updates" from media not tagged as updates: if (!$options{pure_updates} && !$Rpmdrake::pkg::need_restart) { - push @filtered_pkgs, grep { is_updatable($_) } @{$h->{installable}}; + [ @{$h->{updates}}, grep { is_updatable($_) } @{$h->{installable}} ]; + } else { + $h->{updates}; } - @filtered_pkgs; }, - backports => sub { @filtered_pkgs = @{$h->{backports}} }, - meta_pkgs => sub { @filtered_pkgs = @{$h->{meta_pkgs}} }, - gui_pkgs => sub { @filtered_pkgs = @{$h->{gui_pkgs}} }, + backports => sub { $h->{backports} }, + meta_pkgs => sub { $h->{meta_pkgs} }, + gui_pkgs => sub { $h->{gui_pkgs} }, ); foreach my $importance (qw(bugfix security normal)) { $tmp_filter_methods{$importance} = sub { - @filtered_pkgs = grep { + [ grep { my ($name) = split_fullname($_); - $descriptions->{$name}{importance} eq $importance } @{$h->{updates}}; + $descriptions->{$name}{importance} eq $importance } @{$h->{updates}} ]; }; } @@ -551,7 +551,7 @@ sub pkgs_provider { foreach my $type (keys %tmp_filter_methods) { $filter_methods{$type} = sub { $force_rebuild = 1; # force rebuilding tree since we changed filter (FIXME: switch to SortModel) - @filtered_pkgs = intersection($filters{$filter->[0]}, [ $tmp_filter_methods{$type}->() ]); + @filtered_pkgs = intersection($filters{$filter->[0]}, $tmp_filter_methods{$type}->()); }; } |