projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
graph: fix for unitialized graph_value nodes
[fio.git]
/
graph.c
diff --git
a/graph.c
b/graph.c
index 91ddc8937fa4ed53290742f1dc5a563266ec3b33..9761a1ad428b1b7015265456b9779a719105a605 100644
(file)
--- a/
graph.c
+++ b/
graph.c
@@
-33,9
+33,6
@@
#include "graph.h"
#include "flist.h"
#include "lib/prio_tree.h"
#include "graph.h"
#include "flist.h"
#include "lib/prio_tree.h"
-#include "gettime.h"
-struct thread_data;
-#include "time.h"
/*
* Allowable difference to show tooltip
/*
* Allowable difference to show tooltip
@@
-691,6
+688,7
@@
static void graph_label_add_value(struct graph_label *i, void *value,
struct graph_value *x;
x = malloc(sizeof(*x));
struct graph_value *x;
x = malloc(sizeof(*x));
+ memset(x, 0, sizeof(*x));
x->value = value;
if (tooltip)
x->tooltip = strdup(tooltip);
x->value = value;
if (tooltip)
x->tooltip = strdup(tooltip);
@@
-710,13
+708,13
@@
static void graph_label_add_value(struct graph_label *i, void *value,
double miny = yval / TOOLTIP_DELTA;
double maxy = yval * TOOLTIP_DELTA;
double miny = yval / TOOLTIP_DELTA;
double maxy = yval * TOOLTIP_DELTA;
+ INIT_PRIO_TREE_NODE(&x->node);
x->node.start = miny;
x->node.last = maxy;
if (x->node.last == x->node.start)
x->node.last++;
prio_tree_insert(&i->prio_tree, &x->node);
x->node.start = miny;
x->node.last = maxy;
if (x->node.last == x->node.start)
x->node.last++;
prio_tree_insert(&i->prio_tree, &x->node);
- printf("insert (x=%u,y=%u) range %lu-%lu (%s)\n", (int)getx(x), (int)gety(x), x->node.start, x->node.last, x->tooltip);
i->tooltip_count++;
}
i->tooltip_count++;
}
@@
-781,13
+779,18
@@
int graph_add_xy_data(struct graph *bg, const char *label,
return 0;
}
return 0;
}
-static void graph_free_values(struct graph_value *values)
+static void graph_free_values(struct graph_
label *l, struct graph_
value *values)
{
struct graph_value *i, *next;
for (i = values; i; i = next) {
next = i->next;
free(i->value);
{
struct graph_value *i, *next;
for (i = values; i; i = next) {
next = i->next;
free(i->value);
+ if (i->tooltip) {
+ free(i->tooltip);
+ prio_tree_remove(&l->prio_tree, &i->node);
+ l->tooltip_count--;
+ }
free(i);
}
}
free(i);
}
}
@@
-798,7
+801,7
@@
static void graph_free_labels(struct graph_label *labels)
for (i = labels; i; i = next) {
next = i->next;
for (i = labels; i; i = next) {
next = i->next;
- graph_free_values(i->values);
+ graph_free_values(i
, i
->values);
free(i);
}
}
free(i);
}
}