projects
/
monky
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1fa1476
)
Another off-by-one found by valgrind.
author
Pavel Labath
<pavelo@centrum.sk>
Sun, 17 Jan 2010 18:35:35 +0000
(19:35 +0100)
committer
Pavel Labath
<pavelo@centrum.sk>
Sun, 17 Jan 2010 18:51:00 +0000
(19:51 +0100)
src/specials.c
patch
|
blob
|
history
diff --git
a/src/specials.c
b/src/specials.c
index
27b8d83
..
3fa6e0b
100644
(file)
--- a/
src/specials.c
+++ b/
src/specials.c
@@
-324,7
+324,6
@@
static void graph_append(struct special_t *graph, double f, char showaslog)
f = graph->graph_scale;
}
f = graph->graph_scale;
}
- graph->graph[0] = f; /* add new data */
/* shift all the data by 1 */
for (i = graph->graph_width - 1; i > 0; i--) {
graph->graph[i] = graph->graph[i - 1];
/* shift all the data by 1 */
for (i = graph->graph_width - 1; i > 0; i--) {
graph->graph[i] = graph->graph[i - 1];
@@
-333,9
+332,10
@@
static void graph_append(struct special_t *graph, double f, char showaslog)
graph->graph_scale = graph->graph[i - 1];
}
}
graph->graph_scale = graph->graph[i - 1];
}
}
- if (graph->scaled && graph->graph[graph->graph_width] > graph->graph_scale) {
+ graph->graph[0] = f; /* add new data */
+ if (graph->scaled && graph->graph[0] > graph->graph_scale) {
/* check if we need to update the scale */
/* check if we need to update the scale */
- graph->graph_scale = graph->graph[graph->graph_width];
+ graph->graph_scale = graph->graph[0];
}
}
}
}