summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2012-09-07 14:25:21 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2012-09-07 14:25:21 +0000
commit97bb0fc26afb09afce7fc01c4a559c1df5cc65f2 (patch)
tree91a2178f252b034d9628fcc8ca7122ba80608734
parent473a3d0d452612a08ee423de0789545acab5fac9 (diff)
downloadi2c-tools-97bb0fc26afb09afce7fc01c4a559c1df5cc65f2.tar.gz
Optimize the code which computes the column width.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6067 7894878c-1315-0410-8ee3-d5d059ff63e0
-rwxr-xr-xeeprom/decode-dimms18
1 files changed, 10 insertions, 8 deletions
diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms
index 821df7d..c23b211 100755
--- a/eeprom/decode-dimms
+++ b/eeprom/decode-dimms
@@ -1957,19 +1957,21 @@ sub line_has_same_values($)
# Find out the longest value string to adjust the column width
$sbs_col_width = 15;
if ($opt_side_by_side && !$opt_html) {
- for $current (0 .. $#dimm) {
- my @output = @{$dimm[$current]->{output}};
- my $line;
+ my $line;
+ my $line_nr = @{$dimm[0]->{output}};
+
+ for ($line = 0; $line < $line_nr; $line++) {
+ next if $opt_merge && line_has_same_values($line);
+
my @strings;
- for ($line = 0; $line < @output; $line++) {
- next if $opt_merge && line_has_same_values($line);
- my ($func, $label, $value) = @{$output[$line]};
+ for $current (0 .. $#dimm) {
+ my $value = $dimm[$current]->{output}->[$line]->[2];
push @strings, split("\n", $value) if defined $value;
}
- foreach $line (@strings) {
- my $len = length($line);
+ foreach my $line2 (@strings) {
+ my $len = length($line2);
$sbs_col_width = $len if $len > $sbs_col_width;
}
}