From 93c93a0e3646a205013f439013e22d674b224cdb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 13 Mar 2024 11:27:04 +0800 Subject: refactor: remove "once" argument of loop_uv_run() (#27841) It is always set to true when used, and makes the code a bit confusing. --- src/nvim/event/loop.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index 93948d3eaa..e1ebcecbd6 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -39,10 +39,8 @@ void loop_init(Loop *loop, void *data) /// @param ms 0: non-blocking poll. /// > 0: timeout after `ms`. /// < 0: wait forever. -/// @param once true: process at most one `Loop.uv` event. -/// false: process until `ms` timeout (only has effect if `ms` > 0). /// @return true if `ms` > 0 and was reached -bool loop_uv_run(Loop *loop, int64_t ms, bool once) +static bool loop_uv_run(Loop *loop, int64_t ms) { if (loop->recursive++) { abort(); // Should not re-enter uv_run @@ -60,9 +58,7 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once) mode = UV_RUN_NOWAIT; } - do { - uv_run(&loop->uv, mode); - } while (ms > 0 && !once && !*timeout_expired); + uv_run(&loop->uv, mode); if (ms > 0) { uv_timer_stop(&loop->poll_timer); @@ -83,7 +79,7 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once) /// @return true if `ms` > 0 and was reached bool loop_poll_events(Loop *loop, int64_t ms) { - bool timeout_expired = loop_uv_run(loop, ms, true); + bool timeout_expired = loop_uv_run(loop, ms); multiqueue_process_events(loop->fast_events); return timeout_expired; } -- cgit From a89ce89742db600665b69e58d5e1bc3dbee9d57b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 28 Mar 2024 02:32:32 +0100 Subject: docs: fix typos (#27868) Co-authored-by: ite-usagi <77563904+ite-usagi@users.noreply.github.com> Co-authored-by: v-sim <56476039+v-sim@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski Co-authored-by: zeertzjq Co-authored-by: Quico Augustijn Co-authored-by: nhld Co-authored-by: francisco souza <108725+fsouza@users.noreply.github.com> --- src/nvim/event/rstream.c | 2 +- src/nvim/event/wstream.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index f50c8a0e5a..6b4ab472e4 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -106,7 +106,7 @@ static void read_cb(uv_stream_t *uvstream, ssize_t cnt, const uv_buf_t *buf) // http://docs.libuv.org/en/latest/stream.html#c.uv_read_start. // // We don't need to do anything with the RBuffer because the next call - // to `alloc_cb` will return the same unused pointer(`rbuffer_produced` + // to `alloc_cb` will return the same unused pointer (`rbuffer_produced` // won't be called) if (cnt == UV_ENOBUFS || cnt == 0) { return; diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index 406ff1620d..c67a9b96ed 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -103,7 +103,7 @@ err: /// Creates a WBuffer object for holding output data. Instances of this /// object can be reused across Stream instances, and the memory is freed -/// automatically when no longer needed(it tracks the number of references +/// automatically when no longer needed (it tracks the number of references /// internally) /// /// @param data Data stored by the WBuffer @@ -111,7 +111,7 @@ err: /// @param refcount The number of references for the WBuffer. This will be used /// by Stream instances to decide when a WBuffer should be freed. /// @param cb Pointer to function that will be responsible for freeing -/// the buffer data(passing 'free' will work as expected). +/// the buffer data (passing `xfree` will work as expected). /// @return The allocated WBuffer instance WBuffer *wstream_new_buffer(char *data, size_t size, size_t refcount, wbuffer_data_finalizer cb) FUNC_ATTR_NONNULL_ARG(1) -- cgit From ffe3002568f849df1b155b90d6ea0e1f48d8c6d5 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 24 Sep 2023 21:19:01 +0200 Subject: test: silence expected errors This will remove unrelated errors in .nvimlog at the end of test output. --- src/nvim/event/libuv_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index a7966994e0..608aeb4c15 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -90,7 +90,7 @@ int libuv_process_spawn(LibuvProcess *uvproc) int status; if ((status = uv_spawn(&proc->loop->uv, &uvproc->uv, &uvproc->uvopts))) { - ELOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); + DLOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); if (uvproc->uvopts.env) { os_free_fullenv(uvproc->uvopts.env); } -- cgit From ae28ef327e02ac87ef26f941c401312ed0462d8c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Apr 2024 11:18:43 +0800 Subject: fix: adjust error message for error in UI event callback (#28200) Also close Nvim instance before removing log file, otherwise the Nvim instance will still write to the log file. Also adjust log level in libuv_process_spawn(). Ref #27660 --- src/nvim/event/libuv_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 608aeb4c15..f77d686c10 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -90,7 +90,7 @@ int libuv_process_spawn(LibuvProcess *uvproc) int status; if ((status = uv_spawn(&proc->loop->uv, &uvproc->uv, &uvproc->uvopts))) { - DLOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); + ILOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); if (uvproc->uvopts.env) { os_free_fullenv(uvproc->uvopts.env); } -- cgit