mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
param: upgraded json_tok_label
Added utility function json_tok_is_num so I would avoid using goto. Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
committed by
Rusty Russell
parent
4cef0d062c
commit
c32f7910cc
@@ -119,6 +119,17 @@ bool json_tok_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool json_tok_is_num(const char *buffer, const jsmntok_t *tok)
|
||||
{
|
||||
if (tok->type != JSMN_PRIMITIVE)
|
||||
return false;
|
||||
|
||||
for (int i = tok->start; i < tok->end; i++)
|
||||
if (!cisdigit(buffer[i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool json_tok_is_null(const char *buffer, const jsmntok_t *tok)
|
||||
{
|
||||
if (tok->type != JSMN_PRIMITIVE)
|
||||
|
||||
Reference in New Issue
Block a user