Browse Source

Move the code to a function, it's cleaner.

git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6068 7894878c-1315-0410-8ee3-d5d059ff63e0
tags/v4.0
Jean Delvare 13 years ago
parent
commit
1aae8ade6e
  1. 16
      eeprom/decode-dimms

16
eeprom/decode-dimms

@ -1955,8 +1955,12 @@ sub line_has_same_values($)
} }
# Find out the longest value string to adjust the column width # Find out the longest value string to adjust the column width
$sbs_col_width = 15;
if ($opt_side_by_side && !$opt_html) {
sub find_col_width($)
{
my $width = shift;
return $width unless $opt_side_by_side && !$opt_html;
my $line; my $line;
my $line_nr = @{$dimm[0]->{output}}; my $line_nr = @{$dimm[0]->{output}};
@ -1965,18 +1969,22 @@ if ($opt_side_by_side && !$opt_html) {
my @strings; my @strings;
for $current (0 .. $#dimm) {
for my $current (0 .. $#dimm) {
my $value = $dimm[$current]->{output}->[$line]->[2]; my $value = $dimm[$current]->{output}->[$line]->[2];
push @strings, split("\n", $value) if defined $value; push @strings, split("\n", $value) if defined $value;
} }
foreach my $line2 (@strings) { foreach my $line2 (@strings) {
my $len = length($line2); my $len = length($line2);
$sbs_col_width = $len if $len > $sbs_col_width;
$width = $len if $len > $width;
} }
} }
return $width;
} }
$sbs_col_width = find_col_width(15);
# Print the decoded information for all DIMMs # Print the decoded information for all DIMMs
for $current (0 .. $#dimm) { for $current (0 .. $#dimm) {
if ($opt_side_by_side) { if ($opt_side_by_side) {

Loading…
Cancel
Save