From 4b962d32365228d8984759d36269904527927cf3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 21 Aug 2011 16:50:29 +0200 Subject: [PATCH] rrdtool plugin: Fix warning about unused variable "stepsize". Change-Id: Ibd4dd3f17db62b10b96c59f37b66941ddc5ea7b0 --- src/rrdtool.c | 6 ++---- src/utils_rrdcreate.c | 8 +++----- src/utils_rrdcreate.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/rrdtool.c b/src/rrdtool.c index b366a9c6..56a82d03 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -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, diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index 5b132388..d9cbad73 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -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); diff --git a/src/utils_rrdcreate.h b/src/utils_rrdcreate.h index 935e4e07..103ca570 100644 --- a/src/utils_rrdcreate.h +++ b/src/utils_rrdcreate.h @@ -28,7 +28,7 @@ struct rrdcreate_config_s { - int stepsize; + unsigned long stepsize; int heartbeat; int rrarows; double xff; -- 2.30.2