common: remove json_tok.

Make local copies for tests, and fundchannel plugin (which just passes
params through).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-07-04 10:56:36 +09:30 committed by neil saitug
parent a9b992ff4a
commit f12f0d6929
4 changed files with 17 additions and 19 deletions

View File

@ -146,14 +146,6 @@ struct command_result *param_u64(struct command *cmd, const char *name,
"should be an unsigned 64 bit integer");
}
struct command_result *param_tok(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t * tok,
const jsmntok_t **out)
{
*out = tok;
return NULL;
}
struct command_result *param_msat(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t *tok,
struct amount_msat **msat)

View File

@ -114,17 +114,6 @@ struct command_result *param_short_channel_id(struct command *cmd,
const jsmntok_t *tok,
struct short_channel_id **scid);
/*
* Set the address of @out to @tok. Used as a callback by handlers that
* want to unmarshal @tok themselves.
*
* Usage of this is discouraged. Writing a local static bespoke handler is
* preferred.
*/
struct command_result *param_tok(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t * tok,
const jsmntok_t **out);
/* Ignore the token. Not usually used. */
struct command_result *param_ignore(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t *tok,

View File

@ -220,6 +220,14 @@ static void sanity(void)
}
}
static struct command_result *param_tok(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t * tok,
const jsmntok_t **out)
{
*out = tok;
return NULL;
}
/*
* Make sure toks are passed through correctly, and also make sure
* optional missing toks are set to NULL.

View File

@ -28,6 +28,15 @@ fundchannel_get_result(struct command *cmd,
const jsmntok_t *result,
void *nothing UNUSED);
/* Generally a bad idea, but makes sense here. */
static struct command_result *param_tok(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t * tok,
const jsmntok_t **out)
{
*out = tok;
return NULL;
}
/* Thin wrapper aroud multifundchannel. */
static struct command_result *
json_fundchannel(struct command *cmd,