aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2012-09-07 14:25:21 +0000
committerJean Delvare <jdelvare@suse.de>2012-09-07 14:25:21 +0000
commitd4da05d116751a9e564cede71b4a962c04bc85f7 (patch)
tree91a2178f252b034d9628fcc8ca7122ba80608734
parentfd3d0c91d5b1063492ce664b5c17be8ce226e7bf (diff)
downloadi2c-tools-d4da05d116751a9e564cede71b4a962c04bc85f7.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;
}
}