json_util: remove spdk_json_number_to_double()

This function is no longer used for integer parsing, and it does not
work in locales with decimal separators other than '.', which is
required to be the decimal separator for JSON numbers.

Change-Id: I8e97e15cc2699e647652f83b71676c11d32d29ce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/364134
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2017-06-05 15:33:24 -07:00
parent 7089d58244
commit 7c1d827f78
2 changed files with 0 additions and 25 deletions

View File

@ -176,7 +176,6 @@ bool spdk_json_strequal(const struct spdk_json_val *val, const char *str);
*/
char *spdk_json_strdup(const struct spdk_json_val *val);
int spdk_json_number_to_double(const struct spdk_json_val *val, double *num);
int spdk_json_number_to_int32(const struct spdk_json_val *val, int32_t *num);
int spdk_json_number_to_uint32(const struct spdk_json_val *val, uint32_t *num);

View File

@ -199,30 +199,6 @@ spdk_json_number_split(const struct spdk_json_val *val, struct spdk_json_num *nu
return 0;
}
int
spdk_json_number_to_double(const struct spdk_json_val *val, double *num)
{
char buf[32];
char *end;
if (val->type != SPDK_JSON_VAL_NUMBER || val->len >= sizeof(buf)) {
*num = 0.0;
return -1;
}
memcpy(buf, val->start, val->len);
buf[val->len] = '\0';
errno = 0;
/* TODO: strtod() uses locale for decimal point (. is not guaranteed) */
*num = strtod(buf, &end);
if (*end != '\0' || errno != 0) {
return -1;
}
return 0;
}
int
spdk_json_number_to_int32(const struct spdk_json_val *val, int32_t *num)
{