aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-09-03 14:55:55 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-09-12 13:25:28 -0300
commit19bc29ee834516ff76944741b25fe158d2282b15 (patch)
treef00112f755ecb5192b2130ef6246ef8d3afa49fd
parent74aff19691aeea83fa23265719668467db2b049c (diff)
downloadrneovim-19bc29ee834516ff76944741b25fe158d2282b15.tar.gz
rneovim-19bc29ee834516ff76944741b25fe158d2282b15.tar.bz2
rneovim-19bc29ee834516ff76944741b25fe158d2282b15.zip
msgpack-rpc: Move handle_missing_method to msgpack_rpc.c
Since that function is not automatically generated, it's best to place it in a normal C module
-rw-r--r--scripts/msgpack-gen.lua14
-rw-r--r--src/nvim/os/msgpack_rpc.c10
2 files changed, 11 insertions, 13 deletions
diff --git a/scripts/msgpack-gen.lua b/scripts/msgpack-gen.lua
index f868a67568..946cff1d11 100644
--- a/scripts/msgpack-gen.lua
+++ b/scripts/msgpack-gen.lua
@@ -220,18 +220,6 @@ for i = 1, #api.functions do
end
end
-output:write([[
-static Object handle_missing_method(uint64_t channel_id,
- msgpack_object *req,
- Error *error)
-{
- snprintf(error->msg, sizeof(error->msg), "Invalid function id");
- error->set = true;
- return NIL;
-}
-
-]])
-
-- Generate the table of handler functions indexed by method id
output:write([[
static const rpc_method_handler_fn rpc_method_handlers[] = {
@@ -290,7 +278,7 @@ output:write([[
}
if (!handler) {
- handler = handle_missing_method;
+ handler = msgpack_rpc_handle_missing_method;
}
return handler(channel_id, req, error);
diff --git a/src/nvim/os/msgpack_rpc.c b/src/nvim/os/msgpack_rpc.c
index cf32736e16..4a586e8e01 100644
--- a/src/nvim/os/msgpack_rpc.c
+++ b/src/nvim/os/msgpack_rpc.c
@@ -115,6 +115,16 @@ void msgpack_rpc_error(char *msg, msgpack_packer *res)
msgpack_pack_nil(res);
}
+/// Handler executed when an invalid method name is passed
+Object msgpack_rpc_handle_missing_method(uint64_t channel_id,
+ msgpack_object *req,
+ Error *error)
+{
+ snprintf(error->msg, sizeof(error->msg), "Invalid method name");
+ error->set = true;
+ return NIL;
+}
+
/// Serializes a msgpack-rpc request or notification(id == 0)
WBuffer *serialize_request(uint64_t request_id,
String method,