aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/msgpack_rpc
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-06-20 15:04:40 +0200
committerGitHub <noreply@github.com>2022-06-20 15:04:40 +0200
commite3bfc1293e30512a6aa23964a3486ee709ac3f21 (patch)
treec8d1b70ef948a4beafe82195431f1c6607fbe8b7 /src/nvim/msgpack_rpc
parentb2ed439bd5ab1b431bb61f8754554c48453495c5 (diff)
parent5d6987210578f5f1c3151988b99a9411f9603374 (diff)
downloadrneovim-e3bfc1293e30512a6aa23964a3486ee709ac3f21.tar.gz
rneovim-e3bfc1293e30512a6aa23964a3486ee709ac3f21.tar.bz2
rneovim-e3bfc1293e30512a6aa23964a3486ee709ac3f21.zip
Merge pull request #18988 from bfredl/uipack
refactor(ui): encode "redraw" events without intermediate allocations
Diffstat (limited to 'src/nvim/msgpack_rpc')
-rw-r--r--src/nvim/msgpack_rpc/channel.c11
-rw-r--r--src/nvim/msgpack_rpc/unpacker.c4
2 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index b4f39c4c61..388fa2584c 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -360,6 +360,17 @@ free_ret:
api_clear_error(&error);
}
+bool rpc_write_raw(uint64_t id, WBuffer *buffer)
+{
+ Channel *channel = find_rpc_channel(id);
+ if (!channel) {
+ wstream_release_wbuffer(buffer);
+ return false;
+ }
+
+ return channel_write(channel, buffer);
+}
+
static bool channel_write(Channel *channel, WBuffer *buffer)
{
bool success;
diff --git a/src/nvim/msgpack_rpc/unpacker.c b/src/nvim/msgpack_rpc/unpacker.c
index 419349e74d..26c1843026 100644
--- a/src/nvim/msgpack_rpc/unpacker.c
+++ b/src/nvim/msgpack_rpc/unpacker.c
@@ -11,10 +11,6 @@
# include "msgpack_rpc/unpacker.c.generated.h"
#endif
-#define kv_fixsize_arena(a, v, s) \
- ((v).capacity = (s), \
- (v).items = (void *)arena_alloc(a, sizeof((v).items[0]) * (v).capacity, true))
-
Object unpack(const char *data, size_t size, Error *err)
{
Unpacker unpacker;