param: make json_tok_label non-static

Needed to do this so I could remove the implementation in
the run-param test.

Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-08-29 13:43:28 -05:00
committed by Rusty Russell
parent 4f81cd3852
commit 8590dbedfb
4 changed files with 28 additions and 55 deletions

View File

@@ -129,6 +129,25 @@ bool json_tok_double(struct command *cmd, const char *name,
return false;
}
bool json_tok_label(struct command *cmd, const char *name,
const char * buffer, const jsmntok_t *tok,
struct json_escaped **label)
{
if ((*label = json_tok_escaped_string(cmd, buffer, tok)))
return true;
/* Allow literal numbers */
if (json_tok_is_num(buffer, tok) &&
((*label = json_escaped_string_(cmd, buffer + tok->start,
tok->end - tok->start))))
return true;
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"'%s' should be a string or number, not '%.*s'",
name, tok->end - tok->start, buffer + tok->start);
return false;
}
bool json_tok_number(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t *tok,
unsigned int **num)