Skip to content

common/json_parse_simple: drop redundant and wrong json_str_to_u64() #8413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions common/json_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,7 @@ struct command_result *param_extra_tlvs(struct command *cmd, const char *name,
/* Accept either bare ints as keys (not spec
* compliant, but simpler), or ints in strings, which
* are JSON spec compliant. */
if (!(json_str_to_u64(buffer, curr, &f->numtype) ||
json_to_u64(buffer, curr, &f->numtype))) {
if (!json_to_u64(buffer, curr, &f->numtype)) {
return command_fail(
cmd, JSONRPC2_INVALID_PARAMS,
"\"%s\" is not a valid numeric TLV type.",
Expand Down
13 changes: 0 additions & 13 deletions common/json_parse_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,6 @@ bool json_to_s64(const char *buffer, const jsmntok_t *tok, s64 *num)
return true;
}

bool json_str_to_u64(const char *buffer, const jsmntok_t *tok, u64 *num)
{
jsmntok_t temp;
if (tok->type != JSMN_STRING)
return false;

temp = *tok;
temp.start += 1;
temp.end -= 1;

return json_to_u64(buffer, &temp, num);
}

bool json_to_double(const char *buffer, const jsmntok_t *tok, double *num)
{
char *end;
Expand Down
4 changes: 0 additions & 4 deletions common/json_parse_simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ bool json_to_u64(const char *buffer, const jsmntok_t *tok, u64 *num);
/* Extract signed 64 bit integer from this (may be a string, or a number literal) */
bool json_to_s64(const char *buffer, const jsmntok_t *tok, s64 *num);

/* Extract number from string. The number must be the entirety of the
* string between the '"' */
bool json_str_to_u64(const char *buffer, const jsmntok_t *tok, u64 *num);

/* Extract number from this (may be a string, or a number literal) */
bool json_to_u32(const char *buffer, const jsmntok_t *tok, u32 *num);

Expand Down
Loading