From: oetiker Date: Sun, 15 Jan 2006 08:55:53 +0000 (+0000) Subject: make sure gridind is defined under all conditions X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a80d0f7c126b58308698a9c44cbdf195909c9cbb;p=rrdtool.git make sure gridind is defined under all conditions git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@743 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 5000300..ba0460e 100644 --- a/src/rrd_graph.c +++ b/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;