aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-12 09:16:57 -0700
committerGitHub <noreply@github.com>2024-09-12 09:16:57 -0700
commitdeac7df80a1491ae65b68a1a1047902bcd775adc (patch)
treeff7d74dd31dc1eb7bc8fde65886118c3777bb3b6
parentae917dbd06cb0c6908163968ce6fb11802614111 (diff)
downloadrneovim-deac7df80a1491ae65b68a1a1047902bcd775adc.tar.gz
rneovim-deac7df80a1491ae65b68a1a1047902bcd775adc.tar.bz2
rneovim-deac7df80a1491ae65b68a1a1047902bcd775adc.zip
refactor(stream.c): unused params in stream_close #30356
-rw-r--r--src/nvim/event/stream.c16
-rw-r--r--src/nvim/os/shell.c2
2 files changed, 7 insertions, 11 deletions
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index bc1b503f4c..d9c44e06be 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -94,14 +94,17 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream)
stream->events = NULL;
}
-void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data, bool rstream)
+void stream_may_close(Stream *stream, bool rstream)
FUNC_ATTR_NONNULL_ARG(1)
{
+ if (stream->closed) {
+ return;
+ }
assert(!stream->closed);
DLOG("closing Stream: %p", (void *)stream);
stream->closed = true;
- stream->close_cb = on_stream_close;
- stream->close_cb_data = data;
+ stream->close_cb = NULL;
+ stream->close_cb_data = NULL;
#ifdef MSWIN
if (UV_TTY == uv_guess_handle(stream->fd)) {
@@ -115,13 +118,6 @@ void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data, b
}
}
-void stream_may_close(Stream *stream, bool rstream)
-{
- if (!stream->closed) {
- stream_close(stream, NULL, NULL, rstream);
- }
-}
-
void stream_close_handle(Stream *stream, bool rstream)
FUNC_ATTR_NONNULL_ALL
{
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 4b34ed1c4e..0b082c164d 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -1292,7 +1292,7 @@ static void shell_write_cb(Stream *stream, void *data, int status)
msg_schedule_semsg(_("E5677: Error writing input to shell-command: %s"),
uv_err_name(status));
}
- stream_close(stream, NULL, NULL, false);
+ stream_may_close(stream, false);
}
/// Applies 'shellxescape' (p_sxe) and 'shellxquote' (p_sxq) to a command.