From 6ce4f7248746bd547effe763c1676cbb061bb453 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 10 Aug 2017 13:24:40 +0200 Subject: [PATCH] cleanup: call defined() early No need to carry around a hash we don't need if we get one. --- PVE/Storage.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 9829fbd..b226082 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1011,7 +1011,7 @@ sub storage_info { my $slist = []; 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)) { my $want_ctype = 0; @@ -1021,7 +1021,7 @@ sub storage_info { last; } } - next if !$want_ctype || !defined($storage_enabled); + next if !$want_ctype || !$storage_enabled; } my $type = $ids->{$storeid}->{type}; @@ -1034,7 +1034,7 @@ sub storage_info { shared => $ids->{$storeid}->{shared} ? 1 : 0, content => PVE::Storage::Plugin::content_hash_to_string($ids->{$storeid}->{content}), active => 0, - enabled => defined($storage_enabled) ? 1 : 0, + enabled => $storage_enabled ? 1 : 0, }; push @$slist, $storeid;