param: upgraded json_tok_bool

Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-08-13 15:31:40 -05:00
committed by Rusty Russell
parent e5918f4e5a
commit 8ebc95b7b0
8 changed files with 40 additions and 38 deletions

View File

@@ -141,23 +141,6 @@ bool json_tok_is_null(const char *buffer, const jsmntok_t *tok)
return buffer[tok->start] == 'n';
}
bool json_tok_bool(const char *buffer, const jsmntok_t *tok, bool *b)
{
if (tok->type != JSMN_PRIMITIVE)
return false;
if (tok->end - tok->start == strlen("true")
&& memcmp(buffer + tok->start, "true", strlen("true")) == 0) {
*b = true;
return true;
}
if (tok->end - tok->start == strlen("false")
&& memcmp(buffer + tok->start, "false", strlen("false")) == 0) {
*b = false;
return true;
}
return false;
}
bool json_tok_sha256(const char *buffer, const jsmntok_t * tok,
struct sha256 *hash)
{