From 1a952667eef42f8bb15025adcf0eb8a318abe701 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 20 Dec 2018 18:26:20 +0100 Subject: [PATCH] plugin: Remove plugin_request argument from callbacks None of the existing callbacks was making use of it and we will be exposing the method callback interface to outside compilation unit where the struct definition is not visible. So just remove it. Signed-off-by: Christian Decker --- lightningd/plugin.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index bff54d8dc..dc371fe83 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -71,8 +71,7 @@ struct plugin_request { struct json_stream *stream; /* The response handler to be called when plugin gives us an object. */ - void (*cb)(const struct plugin_request *, - const char *buffer, + void (*cb)(const char *buffer, const jsmntok_t *toks, const jsmntok_t *idtok, void *); @@ -195,8 +194,7 @@ static void PRINTF_FMT(2,3) plugin_kill(struct plugin *plugin, char *fmt, ...) */ static struct plugin_request * plugin_request_new_(struct plugin *plugin, - void (*cb)(const struct plugin_request *, - const char *buffer, + void (*cb)(const char *buffer, const jsmntok_t *toks, const jsmntok_t *idtok, void *), @@ -222,7 +220,6 @@ plugin_request_new_(struct plugin *plugin, plugin_request_new_( \ (plugin), \ typesafe_cb_preargs(void, void *, (cb), (arg), \ - const struct plugin_request *, \ const char *buffer, \ const jsmntok_t *toks, \ const jsmntok_t *idtok), \ @@ -326,7 +323,7 @@ static void plugin_response_handle(struct plugin *plugin, } /* We expect the request->cb to copy if needed */ - request->cb(request, plugin->buffer, toks, idtok, request->arg); + request->cb(plugin->buffer, toks, idtok, request->arg); uintmap_del(&plugin->plugins->pending_requests, id); tal_free(request); @@ -633,8 +630,7 @@ static void json_stream_forward_change_id(struct json_stream *stream, json_stream_append(stream, "\n"); } -static void plugin_rpcmethod_cb(const struct plugin_request *req, - const char *buffer, +static void plugin_rpcmethod_cb(const char *buffer, const jsmntok_t *toks, const jsmntok_t *idtok, struct command *cmd) @@ -822,8 +818,7 @@ static void plugin_manifest_timeout(struct plugin *plugin) /** * Callback for the plugin_manifest request. */ -static void plugin_manifest_cb(const struct plugin_request *req, - const char *buffer, +static void plugin_manifest_cb(const char *buffer, const jsmntok_t *toks, const jsmntok_t *idtok, struct plugin *plugin) @@ -1001,8 +996,7 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug) } } -static void plugin_config_cb(const struct plugin_request *req, - const char *buffer, +static void plugin_config_cb(const char *buffer, const jsmntok_t *toks, const jsmntok_t *idtok, struct plugin *plugin)