-static double sstrtod (const char *str) /* {{{ */
-{
- double ret;
- char *endptr;
-
- if (str == NULL)
- return (NAN);
-
- errno = 0;
- endptr = NULL;
- ret = strtod (str, &endptr);
- if ((endptr == str) || (errno != 0))
- return (NAN);
-
- return (ret);
-} /* }}} double sstrtod */
-
-static int string_to_rx_tx_counters (const char *str, /* {{{ */
- uint64_t *rx, uint64_t *tx)
-{
- const char *ptr;
- char *endptr;
-
- if ((str == NULL) || (rx == NULL) || (tx == NULL))
- return (EINVAL);
-
- ptr = str;
- errno = 0;
- endptr = NULL;
- *rx = (uint64_t) strtoull (ptr, &endptr, /* base = */ 10);
- if ((endptr == str) || (errno != 0))
- return (EIO);
-
- assert (endptr != NULL);
- if (*endptr != ',')
- return (EIO);
-
- ptr = endptr + 1;
- errno = 0;
- endptr = NULL;
- *tx = (uint64_t) strtoull (ptr, &endptr, /* base = */ 10);
- if ((endptr == str) || (errno != 0))
- return (EIO);
-
- return (0);
-} /* }}} int string_to_rx_tx_counters */
-