mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
common: add simple json parse wrapper for the complete cases.
We're going to change the API on the more complete JSON parser, so make and use a simple API for the easy cases. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -585,6 +585,17 @@ again:
|
||||
return toks;
|
||||
}
|
||||
|
||||
jsmntok_t *json_parse_simple(const tal_t *ctx, const char *input, int len)
|
||||
{
|
||||
bool valid;
|
||||
jsmntok_t *toks;
|
||||
|
||||
toks = json_parse_input(ctx, input, len, &valid);
|
||||
if (toks && !valid)
|
||||
toks = tal_free(toks);
|
||||
return toks;
|
||||
}
|
||||
|
||||
const char *jsmntype_to_string(jsmntype_t t)
|
||||
{
|
||||
switch (t) {
|
||||
|
||||
Reference in New Issue
Block a user