param: upgraded json_tok_double

Also renamed old version to json_to_double for use as a utility funciton.

Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-08-13 11:42:11 -05:00
committed by Rusty Russell
parent bab8ff991a
commit e5918f4e5a
9 changed files with 50 additions and 30 deletions

View File

@@ -66,7 +66,7 @@ bool json_to_u64(const char *buffer, const jsmntok_t *tok,
return true;
}
bool json_tok_double(const char *buffer, const jsmntok_t *tok, double *num)
bool json_to_double(const char *buffer, const jsmntok_t *tok, double *num)
{
char *end;
@@ -78,7 +78,7 @@ bool json_tok_double(const char *buffer, const jsmntok_t *tok, double *num)
bool json_tok_percent(const char *buffer, const jsmntok_t *tok, double *num)
{
if (!json_tok_double(buffer, tok, num))
if (!json_to_double(buffer, tok, num))
return false;
/* Ensure it is in the range [0.0, 100.0] */