aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/pty_proc_unix.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-09-28 11:56:08 +0200
committerbfredl <bjorn.linse@gmail.com>2024-09-28 20:23:22 +0200
commit76163590f0b1a39e281446b6b6b17d00b0dcae15 (patch)
treeb28b26aacb9a71348ba60ba375d246d869ca09bb /src/nvim/os/pty_proc_unix.c
parentd5f6f61879bac3ac90512efe05d68e3500125a08 (diff)
downloadrneovim-76163590f0b1a39e281446b6b6b17d00b0dcae15.tar.gz
rneovim-76163590f0b1a39e281446b6b6b17d00b0dcae15.tar.bz2
rneovim-76163590f0b1a39e281446b6b6b17d00b0dcae15.zip
refactor(event): change last use of klist to kvec
loop->children might have been a linked list because used to be modified in place while looped over. However the loops that exists rather schedules events to be processed later, outside of the loop, so this can not happen anymore. When a linked list is otherwise useful it is better to use lib/queue_defs.h which defines an _intrusive_ linked list (i e it doesn't need to do allocations for list items like klist ).
Diffstat (limited to 'src/nvim/os/pty_proc_unix.c')
-rw-r--r--src/nvim/os/pty_proc_unix.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/os/pty_proc_unix.c b/src/nvim/os/pty_proc_unix.c
index e629b328fd..3bca065d2d 100644
--- a/src/nvim/os/pty_proc_unix.c
+++ b/src/nvim/os/pty_proc_unix.c
@@ -30,7 +30,6 @@
#endif
#include "auto/config.h"
-#include "klib/klist.h"
#include "nvim/eval/typval.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
@@ -387,8 +386,8 @@ static void chld_handler(uv_signal_t *handle, int signum)
Loop *loop = handle->loop->data;
- kl_iter(WatcherPtr, loop->children, current) {
- Proc *proc = (*current)->data;
+ for (size_t i = 0; i < kv_size(loop->children); i++) {
+ Proc *proc = kv_A(loop->children, i);
do {
pid = waitpid(proc->pid, &stat, WNOHANG);
} while (pid < 0 && errno == EINTR);