rrdtool plugin: Fix warning about unused variable "stepsize".
authorFlorian Forster <octo@collectd.org>
Sun, 21 Aug 2011 14:50:29 +0000 (16:50 +0200)
committerFlorian Forster <octo@collectd.org>
Sun, 21 Aug 2011 14:50:29 +0000 (16:50 +0200)
Change-Id: Ibd4dd3f17db62b10b96c59f37b66941ddc5ea7b0

src/rrdtool.c
src/utils_rrdcreate.c
src/utils_rrdcreate.h

index b366a9c..56a82d0 100644 (file)
@@ -998,7 +998,7 @@ static int rrd_config (const char *key, const char *value)
        }
        else if (strcasecmp ("StepSize", key) == 0)
        {
-               int temp = atoi (value);
+               unsigned long temp = strtoul (value, NULL, 0);
                if (temp > 0)
                        rrdcreate_config.stepsize = temp;
        }
@@ -1161,8 +1161,6 @@ static int rrd_init (void)
                return (0);
        init_once = 1;
 
-       if (rrdcreate_config.stepsize < 0)
-               rrdcreate_config.stepsize = 0;
        if (rrdcreate_config.heartbeat <= 0)
                rrdcreate_config.heartbeat = 2 * rrdcreate_config.stepsize;
 
@@ -1206,7 +1204,7 @@ static int rrd_init (void)
        }
        queue_thread_running = 1;
 
-       DEBUG ("rrdtool plugin: rrd_init: datadir = %s; stepsize = %i;"
+       DEBUG ("rrdtool plugin: rrd_init: datadir = %s; stepsize = %lu;"
                        " heartbeat = %i; rrarows = %i; xff = %lf;",
                        (datadir == NULL) ? "(null)" : datadir,
                        rrdcreate_config.stepsize,
index 5b13238..d9cbad7 100644 (file)
@@ -374,7 +374,7 @@ int cu_rrd_create_file (const char *filename, /* {{{ */
   int ds_num;
   int status = 0;
   time_t last_up;
-  int stepsize;
+  unsigned long stepsize;
 
   if (check_create_dir (filename))
     return (-1);
@@ -413,11 +413,9 @@ int cu_rrd_create_file (const char *filename, /* {{{ */
   if (cfg->stepsize > 0)
     stepsize = cfg->stepsize;
   else
-    stepsize = (int) CDTIME_T_TO_TIME_T (vl->interval);
+    stepsize = (unsigned long) CDTIME_T_TO_TIME_T (vl->interval);
 
-  status = srrd_create (filename,
-      (cfg->stepsize > 0) ? cfg->stepsize : CDTIME_T_TO_TIME_T (vl->interval),
-      last_up,
+  status = srrd_create (filename, stepsize, last_up,
       argc, (const char **) argv);
 
   free (argv);
index 935e4e0..103ca57 100644 (file)
@@ -28,7 +28,7 @@
 
 struct rrdcreate_config_s
 {
-  int    stepsize;
+  unsigned long stepsize;
   int    heartbeat;
   int    rrarows;
   double xff;