From 76163590f0b1a39e281446b6b6b17d00b0dcae15 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sat, 28 Sep 2024 11:56:08 +0200 Subject: 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 ). --- src/nvim/os/pty_proc_unix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/nvim/os/pty_proc_unix.c') 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); -- cgit