From af5f2b5b66bf442b244204990eded78792a8a4f8 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 24 Sep 2018 13:13:52 +0200 Subject: [PATCH] fixup! json: Support streaming JSON messages --- common/json.c | 12 +----------- common/json.h | 4 ---- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/common/json.c b/common/json.c index 0e808ca35..f741f7962 100644 --- a/common/json.c +++ b/common/json.c @@ -148,16 +148,6 @@ const jsmntok_t *json_next(const jsmntok_t *tok) return t; } -const jsmntok_t *json_last_toks(const jsmntok_t *tok) -{ - const jsmntok_t *t = tok; - for (size_t i=0; isize; i++) { - t++; - t = json_last_toks(t); - } - return t; -} - const jsmntok_t *json_get_member(const char *buffer, const jsmntok_t tok[], const char *label) { @@ -224,7 +214,7 @@ again: * ret=JSMN_ERROR_PART, but due to the previous check we know we read at * least one full element, so count tokens that are part of this root * element. */ - ret = json_last_toks(toks) - toks + 1; + ret = json_next(toks) - toks; /* Cut to length and return. */ *valid = true; diff --git a/common/json.h b/common/json.h index 9985e48e9..c5e5b048e 100644 --- a/common/json.h +++ b/common/json.h @@ -106,9 +106,5 @@ void json_add_hex_talarr(struct json_result *result, const tal_t *data); void json_add_object(struct json_result *result, ...); -/* Get a pointer to the last child element of this object */ -const jsmntok_t *json_last_toks(const jsmntok_t *tok); - - const char *json_result_string(const struct json_result *result); #endif /* LIGHTNING_COMMON_JSON_H */