stats: fix Vector2d to display stats correctly when y_subname is not specified.
authorDam Sunwoo <dam.sunwoo@arm.com>
Tue, 10 Jan 2012 00:08:20 +0000 (18:08 -0600)
committerDam Sunwoo <dam.sunwoo@arm.com>
Tue, 10 Jan 2012 00:08:20 +0000 (18:08 -0600)
Vector2d stats with no y_subname were not displayed as the VectorPrint subname was not initialized correctly to reflect the empty field.

src/base/stats/text.cc

index 4cf98ca9e47db1b9a4bfe28f32b91d626019be75..8fb49dc59ea82477ac574dde9613cffa4b6d296b 100644 (file)
@@ -513,7 +513,14 @@ Text::visit(const Vector2dInfo &info)
     bool havesub = false;
     VectorPrint print;
 
-    print.subnames = info.y_subnames;
+    if (!info.y_subnames.empty()) {
+        for (off_type i = 0; i < info.y; ++i) {
+            if (!info.y_subnames[i].empty()) {
+                print.subnames = info.y_subnames;
+            }
+            break;
+        }
+    }
     print.flags = info.flags;
     print.separatorString = info.separatorString;
     print.descriptions = descriptions;