From: Andrew Ruthven Date: Sun, 31 Dec 2023 04:04:55 +0000 (+1300) Subject: Minor adjustment to make code a bit more readable. X-Git-Tag: 1.2.0~7 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22183f2fa8c1bdea1f0b87d8d24a002520cfd393;p=mythtv-status.git Minor adjustment to make code a bit more readable. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index c560c53..282696b 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -89,17 +89,17 @@ $c->{'oneliner_bullets'} ||= 0; # my @size_thresholds = ( { - 'unit' => 'TB', - 'threshold' => 1024 * 1024, + 'unit' => 'TB', + 'threshold' => 1024 * 1024, 'conversion' => 1024 * 1024, - 'make_integer' => 1, + 'make_integer' => 1, 'make_integer_threshold' => 500, }, { - 'unit' => 'GB', - 'threshold' => 50 * 1024, # 50GB seems like a good threshold. + 'unit' => 'GB', + 'threshold' => 50 * 1024, # 50GB seems like a good threshold. 'conversion' => 1024, - 'make_integer' => 1, + 'make_integer' => 1, 'make_integer_threshold' => 500, }, { @@ -1279,19 +1279,13 @@ sub normalise_disk_space { return $_[0]; } elsif ($_[0] =~ /^([.0-9]+) (\w+)$/) { my $space = $1; - my $unit = $2; - - if ($unit eq 'B') { - return $space / (1024 * 1024); - } elsif ($unit eq 'KB') { - return $space / 1024; - } elsif ($unit eq 'MB') { - return $space; - } elsif ($unit eq 'GB') { - return $space * 1024; - } elsif ($unit eq 'TB') { - return $space * 1024 * 1024; - } + my $unit = $2; + + if ($unit eq 'B') { return $space / (1024 * 1024) } + elsif ($unit eq 'KB') { return $space / 1024 } + elsif ($unit eq 'MB') { return $space } + elsif ($unit eq 'GB') { return $space * 1024 } + elsif ($unit eq 'TB') { return $space * 1024 * 1024 } warn "Unknown unit for disk space: $unit. Please let the author of mythtv-status know.\n"; return $space;