graph: fix bogus used initialized warning
[fio.git] / graph.c
diff --git a/graph.c b/graph.c
index 7a35736b7ab02a796f935f7dcd931a0feb096e72..5c865dcf2964fc4c809b1011d45fdbe45c9f3f65 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -180,7 +180,7 @@ static double maxdouble(double a, double b)
 static double find_double_values(struct graph_label *l, double_comparator cmp)
 {
        struct flist_head *entry;
-       double answer, tmp;
+       double answer = 0.0, tmp;
        int first = 1;
 
        if (flist_empty(&l->value_list))
@@ -853,6 +853,17 @@ static void graph_free_labels(struct graph *g)
        }
 }
 
+void graph_clear_values(struct graph *g)
+{
+       struct flist_head *node;
+       struct graph_label *i;
+
+       flist_for_each(node, &g->label_list) {
+               i = flist_entry(node, struct graph_label, list);
+               graph_free_values(i);
+       }
+}
+
 void graph_set_color(struct graph *gr, graph_label_t label, double red,
                     double green, double blue)
 {