Code

make sure gridind is defined under all conditions
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 15 Jan 2006 08:55:53 +0000 (08:55 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 15 Jan 2006 08:55:53 +0000 (08:55 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@743 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c

index 5000300068df4181d507c22a10cb92c89f138ebe..ba0460eecad4cc9e73d034b936f693809a6ab854 100644 (file)
@@ -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;