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:
Rusty Russell
2019-07-26 11:53:47 +09:30
parent 7b1088a235
commit b03369ea2d
4 changed files with 57 additions and 23 deletions

View File

@@ -1193,7 +1193,7 @@ static struct command_result *json_check(struct command *cmd,
if (params->type == JSMN_OBJECT)
name_tok--;
json_tok_remove(&mod_params, (jsmntok_t *)name_tok, 1);
json_tok_remove(&mod_params, mod_params, name_tok, 1);
cmd->mode = CMD_CHECK;
failed = false;