From ac8d83f8d21e6f8d6c1d892813ecfc59623cdab2 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 15 Jan 2006 08:55:53 +0000 Subject: [PATCH] make sure gridind is defined under all conditions git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@743 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 50003000..ba0460ee 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1531,7 +1531,6 @@ calc_horizontal_grid(image_desc_t *im) int decimals, fractionals; im->ygrid_scale.labfact=2; - gridind=-1; range = im->maxval - im->minval; scaledrange = range / im->magfact; @@ -1582,17 +1581,16 @@ calc_horizontal_grid(image_desc_t *im) else { for(i=0;ylab[i].grid > 0;i++){ pixel = im->ysize / (scaledrange / ylab[i].grid); - if (pixel > 7) { - gridind = i; - break; - } + gridind = i; + if (pixel > 7) + break; } for(i=0; i<4;i++) { if (pixel * ylab[gridind].lfac[i] >= 2.5 * im->text_prop[TEXT_PROP_AXIS].size) { - im->ygrid_scale.labfact = ylab[gridind].lfac[i]; + im->ygrid_scale.labfact = ylab[gridind].lfac[i]; break; - } + } } im->ygrid_scale.gridstep = ylab[gridind].grid * im->magfact; -- 2.30.2