cleanup: call defined() early

No need to carry around a hash we don't need if we get one.
This commit is contained in:
Wolfgang Bumiller
2017-08-10 13:24:40 +02:00
parent b43b073b51
commit 6ce4f72487

View File

@ -1011,7 +1011,7 @@ sub storage_info {
my $slist = []; my $slist = [];
foreach my $storeid (keys %$ids) { foreach my $storeid (keys %$ids) {
my $storage_enabled = storage_check_enabled($cfg, $storeid, undef, 1); my $storage_enabled = defined(storage_check_enabled($cfg, $storeid, undef, 1));
if (defined($content)) { if (defined($content)) {
my $want_ctype = 0; my $want_ctype = 0;
@ -1021,7 +1021,7 @@ sub storage_info {
last; last;
} }
} }
next if !$want_ctype || !defined($storage_enabled); next if !$want_ctype || !$storage_enabled;
} }
my $type = $ids->{$storeid}->{type}; my $type = $ids->{$storeid}->{type};
@ -1034,7 +1034,7 @@ sub storage_info {
shared => $ids->{$storeid}->{shared} ? 1 : 0, shared => $ids->{$storeid}->{shared} ? 1 : 0,
content => PVE::Storage::Plugin::content_hash_to_string($ids->{$storeid}->{content}), content => PVE::Storage::Plugin::content_hash_to_string($ids->{$storeid}->{content}),
active => 0, active => 0,
enabled => defined($storage_enabled) ? 1 : 0, enabled => $storage_enabled ? 1 : 0,
}; };
push @$slist, $storeid; push @$slist, $storeid;