common/json: restore json_delve() for simple plugin parsing.

This was removed (as unused) in 6269a4c55d592e8720b7f2a304c21f61f7931238;
now I've even added tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-12-16 15:14:06 +10:30
parent 3773251d4e
commit adf08f8914
3 changed files with 135 additions and 0 deletions

View File

@@ -73,4 +73,9 @@ jsmntok_t *json_tok_copy(const tal_t *ctx, const jsmntok_t *tok);
*/
void json_tok_remove(jsmntok_t **tokens, jsmntok_t *tok, size_t num);
/* Guide is a string with . for members, [] around indexes. */
const jsmntok_t *json_delve(const char *buffer,
const jsmntok_t *tok,
const char *guide);
#endif /* LIGHTNING_COMMON_JSON_H */