[gnome-boxes] resource-graph: Remove redundant loop



commit 34319c633c5cf1f53ef18d57bf66dd3eca79d64a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Feb 25 14:53:20 2015 +0000

    resource-graph: Remove redundant loop
    
    All the points on the graph first appear towards the end of the array so
    we can simply only check our ymax against last element on the array on
    each update.

 src/resource-graph.vala |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/resource-graph.vala b/src/resource-graph.vala
index 06e93d5..38b74b8 100644
--- a/src/resource-graph.vala
+++ b/src/resource-graph.vala
@@ -5,10 +5,8 @@ private class Boxes.ResourceGraph: Gtk.DrawingArea {
     private double[] _points;
     public double[] points { get { return _points; }
         set {
-            for (var i = 0; i < value.length; i++) {
-                if (value[i] > ymax)
-                    ymax = value[i];
-            }
+            if (value[value.length - 1] > ymax)
+                ymax = value[value.length - 1];
 
             _points = value;
             queue_draw ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]