From 9c28f997d3d652d32c34e8cba45e7e6748e65fe2 Mon Sep 17 00:00:00 2001 From: Mark Beckwith Date: Tue, 21 Aug 2018 08:58:55 -0500 Subject: [PATCH] param: json.c style improvements Suggested-by: @rustyrussell Signed-off-by: Mark Beckwith --- lightningd/json.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lightningd/json.c b/lightningd/json.c index c01cccda8..921eee08c 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -1,6 +1,7 @@ #include "json.h" #include #include +#include #include #include #include @@ -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,