mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
common: generalize json_tok_remove.
It assumes the head of the array is the object/array we want to remove from, but that's not true if we're trying to remove from a sub-object. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -75,10 +75,11 @@ void json_tok_print(const char *buffer, const jsmntok_t *params);
|
||||
jsmntok_t *json_tok_copy(const tal_t *ctx, const jsmntok_t *tok);
|
||||
|
||||
/*
|
||||
* Remove @num json values from a json array or object. @tok points
|
||||
* to the first value to remove. The array will be resized.
|
||||
* Remove @num json values from a json array or object @obj. @tok points
|
||||
* to the first value to remove. The array @tokens will be resized.
|
||||
*/
|
||||
void json_tok_remove(jsmntok_t **tokens, jsmntok_t *tok, size_t num);
|
||||
void json_tok_remove(jsmntok_t **tokens,
|
||||
jsmntok_t *obj_or_array, const jsmntok_t *tok, size_t num);
|
||||
|
||||
/* Guide is a string with . for members, [] around indexes. */
|
||||
const jsmntok_t *json_delve(const char *buffer,
|
||||
|
||||
Reference in New Issue
Block a user