mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
param: json.c style improvements
Suggested-by: @rustyrussell Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
parent
317a830e94
commit
9c28f997d3
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "json.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/json.h>
|
||||
#include <common/type_to_string.h>
|
||||
|
@ -98,12 +99,12 @@ bool json_tok_bool(struct command *cmd, const char *name,
|
|||
*b = tal(cmd, bool);
|
||||
if (tok->type == JSMN_PRIMITIVE) {
|
||||
if (tok->end - tok->start == strlen("true")
|
||||
&& !memcmp(buffer + tok->start, "true", strlen("true"))) {
|
||||
&& memeqstr(buffer + tok->start, strlen("true"), "true")) {
|
||||
**b = true;
|
||||
return true;
|
||||
}
|
||||
if (tok->end - tok->start == strlen("false")
|
||||
&& !memcmp(buffer + tok->start, "false", strlen("false"))) {
|
||||
&& memeqstr(buffer + tok->start, strlen("false"), "false")) {
|
||||
**b = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -213,8 +214,7 @@ bool json_tok_short_channel_id(struct command *cmd, const char *name,
|
|||
struct short_channel_id **scid)
|
||||
{
|
||||
*scid = tal(cmd, struct short_channel_id);
|
||||
if (short_channel_id_from_str(buffer + tok->start,
|
||||
tok->end - tok->start, *scid))
|
||||
if (json_to_short_channel_id(buffer, tok, *scid))
|
||||
return true;
|
||||
|
||||
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
|
|
Loading…
Add table
Reference in a new issue