]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
declare temp double at the start of the function
authorTobias Oetiker <tobi@oetiker.ch>
Fri, 15 May 2015 03:18:07 +0000 (23:18 -0400)
committerTobias Oetiker <tobi@oetiker.ch>
Fri, 15 May 2015 03:18:07 +0000 (23:18 -0400)
src/rrd_create.c

index 223c63ef77283412d70d673186b673312ca7e368..04033fb72d2d7fe27da4fce9f9b89361c8e1a670 100644 (file)
@@ -456,7 +456,8 @@ int parseRRA(const char *def,
     int       cf_id = -1;
     int       token_min = 4;
     const char *parsetime_error = NULL;
-
+    double    tmpdbl;
+    
     memset(rra_def, 0, sizeof(rra_def_t));
 
     argvcopy = strdup(def);
@@ -531,13 +532,12 @@ int parseRRA(const char *def,
                    rrd_set_error("Invalid row count %s: %s", token, parsetime_error);
                break;
            default:
-               double xff;
-               if (rrd_strtodbl(token, NULL, &xff, NULL) != 2
-                   || xff < 0.0 || xff >= 1.0 ){
+               if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2
+                   || tmpdbl < 0.0 || tmpdbl >= 1.0 ){
                    rrd_set_error
                        ("Invalid xff: must be between 0 and 1");
                 }
-               rra_def->par[RRA_cdp_xff_val].u_val = xff;
+               rra_def->par[RRA_cdp_xff_val].u_val = tmpdbl;
                break;
            }
            break;
@@ -546,23 +546,21 @@ int parseRRA(const char *def,
                    (rra_def->cf_nam)) {
            case CF_HWPREDICT:
            case CF_MHWPREDICT:
-               double hw_alpha;
-               if (rrd_strtodbl(token, NULL, &hw_alpha, NULL) != 2
-                   || hw_alpha <= 0.0 || hw_alpha >= 1.0){
+               if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2
+                   || tmpdbl <= 0.0 || tmpdbl >= 1.0){
                    rrd_set_error
                        ("Invalid alpha: must be between 0 and 1");
                 }              
-               rra_def->par[RRA_hw_alpha].u_val = hw_alpha;
+               rra_def->par[RRA_hw_alpha].u_val = tmpdbl;
                break;
            case CF_DEVSEASONAL:
            case CF_SEASONAL:
-               double gamma;
-               if (rrd_strtodbl(token, NULL, &gamma, NULL) != 2
-                   || gamma <= 0.0 || gamma >= 1.0){
+               if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2
+                   || tmpdbl <= 0.0 || tmpdbl >= 1.0){
                    rrd_set_error
                        ("Invalid gamma: must be between 0 and 1");
                 }              
-               rra_def->par[RRA_seasonal_gamma].u_val = gamma;
+               rra_def->par[RRA_seasonal_gamma].u_val = tmpdbl;
                rra_def->par[RRA_seasonal_smooth_idx].u_cnt =
                    hash % rra_def->row_cnt;
                break;
@@ -591,13 +589,12 @@ int parseRRA(const char *def,
            switch (cf_conv(rra_def->cf_nam)) {
            case CF_HWPREDICT:
            case CF_MHWPREDICT:
-               double beta;
-               if (rrd_strtodbl(token, NULL, &beta, NULL) != 2
-                   || beta < 0.0 || beta > 1.0){
+               if (rrd_strtodbl(token, NULL, &tmpdbl, NULL) != 2
+                   || tmpdbl < 0.0 || tmpdbl > 1.0){
                    rrd_set_error
                        ("Invalid beta: must be between 0 and 1");
                 }              
-               rra_def->par[RRA_hw_beta].u_val = beta;
+               rra_def->par[RRA_hw_beta].u_val = tmpdbl;
                break;
            case CF_DEVSEASONAL:
            case CF_SEASONAL: