diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-01 15:22:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 15:22:22 +0800 |
commit | 548f03c66c08d0235d62505e884e8088bfda1804 (patch) | |
tree | 2c524d5d4561e600ca38c5072e9ae5df2cbd8672 /src/nvim/msgpack_rpc | |
parent | 130cb4815a5c6625a938b1e93a7d60d7a38ad8dd (diff) | |
download | rneovim-548f03c66c08d0235d62505e884e8088bfda1804.tar.gz rneovim-548f03c66c08d0235d62505e884e8088bfda1804.tar.bz2 rneovim-548f03c66c08d0235d62505e884e8088bfda1804.zip |
refactor: change event_create() to a macro (#26343)
A varargs functions can never be inlined, so a macro is faster.
Diffstat (limited to 'src/nvim/msgpack_rpc')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 50210e4936..acc21bbf7e 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -404,7 +404,7 @@ static void handle_request(Channel *channel, Unpacker *p, Array args) if (is_get_mode && !input_blocking()) { // Defer the event to a special queue used by os/input.c. #6247 - multiqueue_put(ch_before_blocking_events, request_event, 1, evdata); + multiqueue_put(ch_before_blocking_events, request_event, evdata); } else { // Invoke immediately. request_event((void **)&evdata); @@ -412,12 +412,11 @@ static void handle_request(Channel *channel, Unpacker *p, Array args) } else { bool is_resize = p->handler.fn == handle_nvim_ui_try_resize; if (is_resize) { - Event ev = event_create_oneshot(event_create(request_event, 1, evdata), - 2); + Event ev = event_create_oneshot(event_create(request_event, evdata), 2); multiqueue_put_event(channel->events, ev); multiqueue_put_event(resize_events, ev); } else { - multiqueue_put(channel->events, request_event, 1, evdata); + multiqueue_put(channel->events, request_event, evdata); DLOG("RPC: scheduled %.*s", (int)p->method_name_len, p->handler.name); } } @@ -484,7 +483,7 @@ static bool channel_write(Channel *channel, WBuffer *buffer) if (channel->streamtype == kChannelStreamInternal) { channel_incref(channel); - CREATE_EVENT(channel->events, internal_read_event, 2, channel, buffer); + CREATE_EVENT(channel->events, internal_read_event, channel, buffer); success = true; } else { Stream *in = channel_instream(channel); |