]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
rrd_strtoding should be called rrd_strtodbl
authorTobias Oetiker <tobi@oetiker.ch>
Wed, 20 Aug 2014 12:17:34 +0000 (14:17 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 20 Aug 2014 12:17:34 +0000 (14:17 +0200)
13 files changed:
src/librrd.sym.in.in
src/rrd_client.c
src/rrd_create.c
src/rrd_daemon.c
src/rrd_fetch_libdbi.c
src/rrd_graph.c
src/rrd_graph_helper.c
src/rrd_restore.c
src/rrd_rpncalc.c
src/rrd_strtod.c
src/rrd_strtod.h
src/rrd_tune.c
src/rrd_update.c

index 44509fff487549a9115c42b63b6118e316ae3bcb..48ff5319bac17b724fbda397c9008fe100c37b10 100644 (file)
@@ -53,7 +53,7 @@ rrd_set_error
 rrd_set_to_DINF
 rrd_set_to_DNAN
 rrd_strtod
-rrd_strtoding
+rrd_strtodbl
 rrd_snprintf
 rrd_strerror
 rrd_strversion
index a5f225792e363ff2df2b1b5a07bf04d0cec46edb..5680fc0899fa9364df37a40e2a82c551e721a98c 100644 (file)
@@ -269,7 +269,7 @@ static int parse_value_array_header (char *line, /* {{{ */
    * will expect a comma as the decimal separator, i.e. "42,77". */
   for (i = 0; i < array_len; i++)
   {
-    if( rrd_strtoding(str_array[i], 0, &tmp, "parse_value_array_header") == 2) {
+    if( rrd_strtodbl(str_array[i], 0, &tmp, "parse_value_array_header") == 2) {
         array[i] = (rrd_value_t)tmp;
     } else {
         free(str_array);
@@ -1586,7 +1586,7 @@ int rrdc_stats_get (rrdc_stats_t **ret_stats) /* {{{ */
         || (strcmp ("TreeNodesNumber", key) == 0))
     {
       s->type = RRDC_STATS_TYPE_GAUGE;
-      rrd_strtoding(value, &endptr, &(s->value.gauge),
+      rrd_strtodbl(value, &endptr, &(s->value.gauge),
                                     "QueueLength or TreeDepth or TreeNodesNumber");
     }
     else if ((strcmp ("DataSetsWritten", key) == 0)
index 185e2d4d0e5d01a58589c2f2eab1b56edd87b3ff..d798ef3ebf960248eac1f5039ba98a8597cb798b 100644 (file)
@@ -666,12 +666,12 @@ void parseGENERIC_DS(
             if (minstr[0] == 'U' && minstr[1] == 0)
                 ds_def->par[DS_min_val].u_val = DNAN;
             else
-                if( rrd_strtoding(minstr, 0, &(ds_def->par[DS_min_val].u_val), "parsing min val") != 2 ) return;
+                if( rrd_strtodbl(minstr, 0, &(ds_def->par[DS_min_val].u_val), "parsing min val") != 2 ) return;
 
             if (maxstr[0] == 'U' && maxstr[1] == 0)
                 ds_def->par[DS_max_val].u_val = DNAN;
             else
-                if( rrd_strtoding(maxstr, 0, &(ds_def->par[DS_max_val].u_val), "parsing max val") != 2 ) return;
+                if( rrd_strtodbl(maxstr, 0, &(ds_def->par[DS_max_val].u_val), "parsing max val") != 2 ) return;
 
             if ( ds_def->par[DS_min_val].u_val >= ds_def->par[DS_max_val].u_val ) {
                 parsetime_error = "min must be less than max in DS definition";
index 886e65d8b6d3aa9839940e8766e3bd40a324d42e..ef4ec1070f440c357b50a8661ecd3b2216915873 100644 (file)
@@ -1512,7 +1512,7 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */
 
     /* make sure update time is always moving forward. We use double here since
        update does support subsecond precision for timestamps ... */
-    if ( ( rrd_strtoding( value, &eostamp, &stamp, "error while parsing time stamp" ) != 1 ) || *eostamp != ':')
+    if ( ( rrd_strtodbl( value, &eostamp, &stamp, "error while parsing time stamp" ) != 1 ) || *eostamp != ':')
     {
       pthread_mutex_unlock(&cache_lock);
       return send_response(sock, RESP_ERR,
index 2d73fc0fefa55a626c6b786fabc4447cb8f7d3b0..70f88fdd05a02169055fd494c99eab22b39184b4 100644 (file)
@@ -102,7 +102,7 @@ static double rrd_fetch_dbi_double(dbi_result *result,int idx) {
   switch (type) {
     case DBI_TYPE_STRING:
       ptmp=(char*)dbi_result_get_string_idx(result,idx);
-      strtod_ret_val = rrd_strtoding(ptmp,NULL, &value, "rrd_fetch_dbi_double, DBI_TYPE_STRING");
+      strtod_ret_val = rrd_strtodbl(ptmp,NULL, &value, "rrd_fetch_dbi_double, DBI_TYPE_STRING");
       if( strtod_ret_val == 1 || strtod_ret_val == 2 ) {
         break;
       } else {
@@ -137,7 +137,7 @@ static double rrd_fetch_dbi_double(dbi_result *result,int idx) {
        }
       }
       /* convert to number */
-      strtod_ret_val = rrd_strtoding(ptmp,NULL, &value, "rrd_fetch_dbi_double, DBI_TYPE_BINARY");
+      strtod_ret_val = rrd_strtodbl(ptmp,NULL, &value, "rrd_fetch_dbi_double, DBI_TYPE_BINARY");
       /* free pointer */
       free(ptmp);
       break;
index 5d89cff85a25cdaf1ab1087bc13846c0a833abb7..db1228184dfd040fc8d9b5b0cd4647c010581c71 100644 (file)
@@ -4583,7 +4583,7 @@ void rrd_graph_options(
             im->forceleftspace = 1;
             break;
         case 'T':
-            rrd_strtoding(optarg, 0, &(im->tabwidth), "Function rrd_graph_options, option 'T'");
+            rrd_strtodbl(optarg, 0, &(im->tabwidth), "Function rrd_graph_options, option 'T'");
             break;
         case 'S':
             im->step = atoi(optarg);
@@ -4652,7 +4652,7 @@ void rrd_graph_options(
                 break;
             };
             if (sscanf(optarg, "%[-0-9.e+]:%d", double_str , &im->ylabfact) == 2) {
-                rrd_strtoding( double_str, 0, &(im->ygridstep), "Function rrd_graph_options, option 'y'");
+                rrd_strtodbl( double_str, 0, &(im->ygridstep), "Function rrd_graph_options, option 'y'");
                 if (im->ygridstep <= 0) {
                     rrd_set_error("grid step must be > 0");
                     return;
@@ -4673,8 +4673,8 @@ void rrd_graph_options(
                       "%[-0-9.e+]:%[-0-9.e+]",
                       double_str,
                       double_str2 ) != 2) {
-                rrd_strtoding( double_str, 0, &(im->grid_dash_on), "Function rrd_graph_options, option 1008");
-                rrd_strtoding( double_str2, 0, &(im->grid_dash_off), "Function rrd_graph_options, option 1008");
+                rrd_strtodbl( double_str, 0, &(im->grid_dash_on), "Function rrd_graph_options, option 1008");
+                rrd_strtodbl( double_str2, 0, &(im->grid_dash_off), "Function rrd_graph_options, option 1008");
                 rrd_set_error("expected grid-dash format float:float");
                 return;
             }
@@ -4691,8 +4691,8 @@ void rrd_graph_options(
                       "%[-0-9.e+]:%[-0-9.e+]",
                       double_str,
                       double_str2 ) == 2) {
-                rrd_strtoding( double_str, 0, &(im->second_axis_scale), "Function rrd_graph_options, option 1002");
-                rrd_strtoding( double_str2, 0, &(im->second_axis_shift), "Function rrd_graph_options, option 1002");
+                rrd_strtodbl( double_str, 0, &(im->second_axis_scale), "Function rrd_graph_options, option 1002");
+                rrd_strtodbl( double_str2, 0, &(im->second_axis_shift), "Function rrd_graph_options, option 1002");
                 if(im->second_axis_scale==0){
                     rrd_set_error("the second_axis_scale  must not be 0");
                     return;
@@ -4739,10 +4739,10 @@ void rrd_graph_options(
             }
             break;
         case 'u':
-            rrd_strtoding(optarg, 0, &(im->maxval), "Function rrd_graph_options, option 'u'");
+            rrd_strtodbl(optarg, 0, &(im->maxval), "Function rrd_graph_options, option 'u'");
             break;
         case 'l':
-            rrd_strtoding(optarg, 0, &(im->minval), "Function rrd_graph_options, option 'l'");
+            rrd_strtodbl(optarg, 0, &(im->minval), "Function rrd_graph_options, option 'l'");
             break;
         case 'b':
             im->base = atol(optarg);
@@ -4855,7 +4855,7 @@ void rrd_graph_options(
             int       end;
 
             if (sscanf(optarg, "%10[A-Z]:%[-0-9.e+]%n", prop, double_str, &end) >= 2) {
-                rrd_strtoding( double_str, 0, &size, "Function rrd_graph_options, option 'n'" );
+                rrd_strtodbl( double_str, 0, &size, "Function rrd_graph_options, option 'n'" );
                 int       sindex, propidx;
 
                 if ((sindex = text_prop_conv(prop)) != -1) {
@@ -4890,7 +4890,7 @@ void rrd_graph_options(
             break;
         }
         case 'm':
-            rrd_strtoding(optarg, 0, &(im->zoom), "Function rrd_graph_options, option 'm'");
+            rrd_strtodbl(optarg, 0, &(im->zoom), "Function rrd_graph_options, option 'm'");
             if (im->zoom <= 0.0) {
                 rrd_set_error("zoom factor must be > 0");
                 return;
@@ -5162,7 +5162,7 @@ int vdef_parse(
 
     n = 0;
     sscanf(str, "%20[-0-9.e+],%29[A-Z]%n", double_str, func, &n);
-    if ( rrd_strtoding( str, NULL, &param, "Function vdef_parse" ) != 2){
+    if ( rrd_strtodbl( str, NULL, &param, "Function vdef_parse" ) != 2){
         rrd_clear_error();
         n = 0;
         sscanf(str, "%29[A-Z]%n", func, &n);
index ac22de0a82a4c6fd5fffcacc0926ebe2d46cb0a7..29325241723b58f359aff521ca9e259c9b07ad95 100644 (file)
@@ -144,13 +144,13 @@ int getDouble(const char* v, double *val,char**extra) {
   unsigned int strtod_ret;
   *extra=NULL;
 
-  if( rrd_strtoding( v, extra, val, "Function getDouble" ) != 2 ) {
+  if( rrd_strtodbl( v, extra, val, "Function getDouble" ) != 2 ) {
     return -1;
   }
 
-  strtod_ret = rrd_strtoding( v, extra, val, "Function getDouble" );
+  strtod_ret = rrd_strtodbl( v, extra, val, "Function getDouble" );
 
-  /* see rrd_strtoding's return values for more infromation */
+  /* see rrd_strtodbl's return values for more infromation */
   if( strtod_ret == 0 )
     return -1;
   else if( strtod_ret == 1 )
index bfdfa73c686d32deb888ad873f29e2ec77548b12..ae5772b1df784c6f609bcdffdb3093f16ad975b3 100644 (file)
@@ -329,7 +329,7 @@ static int get_xml_double(
             xmlFree(text);
             return 0;            
         }        
-        if ( rrd_strtoding((char *)text,NULL, &temp, "Function xml_get_double") != 2 ){
+        if ( rrd_strtodbl((char *)text,NULL, &temp, "Function xml_get_double") != 2 ){
             rrd_set_error("ling %d: get_xml_double from '%s' %s",
                           xmlTextReaderGetParserLineNumber(reader),
                           text,rrd_strerror(errno));
index 61ae6a737f1ceb6daf9d7c092950d319ff85dd62..1b3a1c84dde5733aee3f699f2a58ff0b517d4ac8 100644 (file)
@@ -322,7 +322,7 @@ rpnp_t   *rpn_parse(
 
         else if ((sscanf(expr, "%19[-0-9.e+]%n", double_str, &pos) == 1)
                  && (expr[pos] == ',')
-                 && ( rrd_strtoding( double_str, NULL, &(rpnp[steps].val), "parsing double in RPN expression" ) == 2 )) {
+                 && ( rrd_strtodbl( double_str, NULL, &(rpnp[steps].val), "parsing double in RPN expression" ) == 2 )) {
             rpnp[steps].op = OP_NUMBER;
             expr += pos;
         }
index bd97fa65a0d1a72ec3407e9876f3b73ef1f6550f..98aef39e5e0d3108fd3d71b1cccd9267ab5abf61 100644 (file)
@@ -44,7 +44,7 @@
 
 /* returns 2 on success */
 /* i.e. if the whole string has been converted to a double successfully */
-unsigned int rrd_strtoding
+unsigned int rrd_strtodbl
 (const char *str, char **endptr, double *dbl, char *error) {
     char *local_endptr = (char *)str;
     *dbl = rrd_strtod( str, &local_endptr );
index 49b50dd8bba1d451f8843491868d0ad22c822ff4..b9d9dcb05b921df92b6457a04a670dde9a675e7e 100644 (file)
@@ -1,2 +1,2 @@
-unsigned int rrd_strtoding(const char * str, char ** endptr, double * dbl, char * error);
+unsigned int rrd_strtodbl(const char * str, char ** endptr, double * dbl, char * error);
 double rrd_strtod(const char *str, char **endptr);
index f95361dfda9fcbe460f0d3f102e37775ed8e5c0c..25831c9b5b19978734f7605ed20f107864a929b5 100644 (file)
@@ -209,7 +209,7 @@ int rrd_tune(
         case 'i':
             matches = sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str);
             if( matches >= 1 ) {
-                strtod_ret_val = rrd_strtoding( double_str, 0, &min, "Function rrd_tune, option i" );
+                strtod_ret_val = rrd_strtodbl( double_str, 0, &min, "Function rrd_tune, option i" );
             }
 
             if ((matches < 1) || (strtod_ret_val != 2)) {
@@ -229,7 +229,7 @@ int rrd_tune(
         case 'a':
             matches = sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str);
             if( matches >= 1 ) {
-                strtod_ret_val = rrd_strtoding( double_str, 0, &max, "Function rrd_tune, option i" );
+                strtod_ret_val = rrd_strtodbl( double_str, 0, &max, "Function rrd_tune, option i" );
             }
 
             if ((matches < 1 ) || (strtod_ret_val != 2)) {
@@ -430,7 +430,7 @@ int set_hwarg(
     signed short rra_idx = -1;
     unsigned int strtod_ret_val;
 
-    strtod_ret_val = rrd_strtoding(arg, 0, &param, "Error while parsing Holt-Winters parameter");
+    strtod_ret_val = rrd_strtodbl(arg, 0, &param, "Error while parsing Holt-Winters parameter");
     /* read the value */
     if ((strtod_ret_val == 1 || strtod_ret_val == 2 ) &&
          (param <= 0.0 || param >= 1.0) ) {
@@ -469,7 +469,7 @@ int set_hwsmootharg(
     unsigned int strtod_ret_val;
 
     /* read the value */
-    strtod_ret_val = rrd_strtoding(arg, 0, &param, "Error while parsing Holt-Winters parameter, function set_hesmootharg");
+    strtod_ret_val = rrd_strtodbl(arg, 0, &param, "Error while parsing Holt-Winters parameter, function set_hesmootharg");
     /* in order to avoid smoothing of SEASONAL or DEVSEASONAL, we need to 
      * the 0.0 value*/
     if ( (strtod_ret_val == 1 || strtod_ret_val == 2 ) &&
@@ -507,7 +507,7 @@ int set_deltaarg(
     signed short rra_idx = -1;
     unsigned int strtod_ret_val;
 
-    strtod_ret_val = rrd_strtoding(arg, 0, &param, "Function set_deltaarg" );
+    strtod_ret_val = rrd_strtodbl(arg, 0, &param, "Function set_deltaarg" );
     if ((strtod_ret_val == 1 || strtod_ret_val == 2) &&
          param < 0.1) {
         rrd_set_error("Parameter specified is too small");
index eb994bc71d6a928c1dfd1f7d4554f072446956f9..588c34608fe47f2489dc9804fcae18dba8256d6f 100644 (file)
@@ -1317,7 +1317,7 @@ static int get_time_from_reading(
         *current_time = tmp_time.tv_sec;
         *current_time_usec = tmp_time.tv_usec;
     } else {
-        if ( rrd_strtoding( updvals[0], 0, &tmp, "error while parsing time in get_time_from_reading") != 2) {
+        if ( rrd_strtodbl( updvals[0], 0, &tmp, "error while parsing time in get_time_from_reading") != 2) {
             return -1;
         };
         if (tmp < 0.0){
@@ -1422,13 +1422,13 @@ static int update_pdp_prep(
                 }
                 break;
             case DST_ABSOLUTE:
-                if( rrd_strtoding(updvals[ds_idx + 1], 0, &pdp_new[ds_idx], "Function update_pdp_prep, case DST_ABSOLUTE" ) != 2 ) {
+                if( rrd_strtodbl(updvals[ds_idx + 1], 0, &pdp_new[ds_idx], "Function update_pdp_prep, case DST_ABSOLUTE" ) != 2 ) {
                     return -1;
                 }
                 rate = pdp_new[ds_idx] / interval;
                 break;
             case DST_GAUGE:
-                if( rrd_strtoding( updvals[ds_idx + 1], 0, &tmp, "Function update_pdp_prep, case DST_GAUGE") == 2 ) {
+                if( rrd_strtodbl( updvals[ds_idx + 1], 0, &tmp, "Function update_pdp_prep, case DST_GAUGE") == 2 ) {
                     pdp_new[ds_idx] = tmp * interval;
                 } else {
                     return -1;