diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2016-09-01 18:32:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-01 18:32:37 +0200 |
commit | c6ac4f84b16324b56c38bd2003f037d995262fa1 (patch) | |
tree | 5ece44d718f6511d468ac4fe35030a795044999c /src/nvim/msgpack_rpc | |
parent | 0ade1bb7067d0cdb9b059fb66a8c4b868408be9c (diff) | |
parent | acb7c826b3df50bd9825baf3b2ffaaa79c8b80df (diff) | |
download | rneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.tar.gz rneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.tar.bz2 rneovim-c6ac4f84b16324b56c38bd2003f037d995262fa1.zip |
Merge pull request #4934 from bfredl/api
make the API callable from vimL, rename API functions to common nvim_ prefix
Diffstat (limited to 'src/nvim/msgpack_rpc')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 3 | ||||
-rw-r--r-- | src/nvim/msgpack_rpc/defs.h | 28 | ||||
-rw-r--r-- | src/nvim/msgpack_rpc/helpers.c | 6 |
3 files changed, 4 insertions, 33 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 8b5f212d66..cd12f258b6 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -465,8 +465,7 @@ static void on_request_event(void **argv) } else { api_free_object(result); } - // All arguments were freed already, but we still need to free the array - xfree(args.items); + api_free_array(args); decref(channel); xfree(e); } diff --git a/src/nvim/msgpack_rpc/defs.h b/src/nvim/msgpack_rpc/defs.h deleted file mode 100644 index 5611636d4f..0000000000 --- a/src/nvim/msgpack_rpc/defs.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef NVIM_MSGPACK_RPC_DEFS_H -#define NVIM_MSGPACK_RPC_DEFS_H - - -/// The rpc_method_handlers table, used in msgpack_rpc_dispatch(), stores -/// functions of this type. -typedef struct { - Object (*fn)(uint64_t channel_id, - uint64_t request_id, - Array args, - Error *error); - bool async; // function is always safe to run immediately instead of being - // put in a request queue for handling when nvim waits for input. -} MsgpackRpcRequestHandler; - -/// Initializes the msgpack-rpc method table -void msgpack_rpc_init_method_table(void); - -// Add a handler to the method table -void msgpack_rpc_add_method_handler(String method, - MsgpackRpcRequestHandler handler); - -void msgpack_rpc_init_function_metadata(Dictionary *metadata); - -MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name, - size_t name_len) - FUNC_ATTR_NONNULL_ARG(1); -#endif // NVIM_MSGPACK_RPC_DEFS_H diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 9195b10614..33e9bb1c07 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -4,9 +4,9 @@ #include <msgpack.h> +#include "nvim/api/private/dispatch.h" #include "nvim/api/private/helpers.h" #include "nvim/msgpack_rpc/helpers.h" -#include "nvim/msgpack_rpc/defs.h" #include "nvim/lib/kvec.h" #include "nvim/vim.h" #include "nvim/log.h" @@ -40,7 +40,7 @@ static msgpack_sbuffer sbuffer; return false; \ } \ \ - *arg = data.via.u64; \ + *arg = (handle_T)data.via.i64; \ return true; \ } \ \ @@ -49,7 +49,7 @@ static msgpack_sbuffer sbuffer; { \ msgpack_packer pac; \ msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \ - msgpack_pack_uint64(&pac, o); \ + msgpack_pack_int64(&pac, o); \ msgpack_pack_ext(res, sbuffer.size, kObjectType##t); \ msgpack_pack_ext_body(res, sbuffer.data, sbuffer.size); \ msgpack_sbuffer_clear(&sbuffer); \ |