From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/event/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 10756015ad..52a3c81449 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -224,7 +224,7 @@ bool socket_connect(Loop *loop, Stream *stream, bool is_tcp, const char *address const struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, - .ai_flags = AI_NUMERICSERV }; + .ai_flags = AI_NUMERICSERV }; int retval = uv_getaddrinfo(&loop->uv, &addr_req, NULL, addr, host_end + 1, &hints); if (retval != 0) { -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/event/socket.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 52a3c81449..62326de075 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -64,10 +61,10 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint uv_tcp_init(&loop->uv, &watcher->uv.tcp.handle); uv_tcp_nodelay(&watcher->uv.tcp.handle, true); - watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.tcp.handle); + watcher->stream = (uv_stream_t *)(&watcher->uv.tcp.handle); } else { uv_pipe_init(&loop->uv, &watcher->uv.pipe.handle, 0); - watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.pipe.handle); + watcher->stream = (uv_stream_t *)(&watcher->uv.pipe.handle); } watcher->stream->data = watcher; @@ -102,9 +99,8 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb) // contain 0 in this case, unless uv_tcp_getsockname() is used first. uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas, &(int){ sizeof(sas) }); - uint16_t port = (uint16_t)((sas.ss_family == AF_INET) - ? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port - : (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port); + uint16_t port = (sas.ss_family == AF_INET) ? ((struct sockaddr_in *)(&sas))->sin_port + : ((struct sockaddr_in6 *)(&sas))->sin6_port; // v:servername uses the string from watcher->addr size_t len = strlen(watcher->addr); snprintf(watcher->addr + len, sizeof(watcher->addr) - len, ":%" PRIu16, @@ -142,11 +138,11 @@ int socket_watcher_accept(SocketWatcher *watcher, Stream *stream) uv_stream_t *client; if (watcher->stream->type == UV_TCP) { - client = STRUCT_CAST(uv_stream_t, &stream->uv.tcp); + client = (uv_stream_t *)(&stream->uv.tcp); uv_tcp_init(watcher->uv.tcp.handle.loop, (uv_tcp_t *)client); uv_tcp_nodelay((uv_tcp_t *)client, true); } else { - client = STRUCT_CAST(uv_stream_t, &stream->uv.pipe); + client = (uv_stream_t *)&stream->uv.pipe; uv_pipe_init(watcher->uv.pipe.handle.loop, (uv_pipe_t *)client, 0); } @@ -165,7 +161,7 @@ void socket_watcher_close(SocketWatcher *watcher, socket_close_cb cb) FUNC_ATTR_NONNULL_ARG(1) { watcher->close_cb = cb; - uv_close(STRUCT_CAST(uv_handle_t, watcher->stream), close_cb); + uv_close((uv_handle_t *)watcher->stream, close_cb); } static void connection_event(void **argv) @@ -242,11 +238,11 @@ tcp_retry: uv_pipe_t *pipe = &stream->uv.pipe; uv_pipe_init(&loop->uv, pipe, 0); uv_pipe_connect(&req, pipe, address, connect_cb); - uv_stream = STRUCT_CAST(uv_stream_t, pipe); + uv_stream = (uv_stream_t *)pipe; } status = 1; LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, timeout, status != 1); - if (status == 0) { // -V547 + if (status == 0) { stream_init(NULL, stream, -1, uv_stream); success = true; } else if (is_tcp && addrinfo->ai_next) { -- cgit From bb4b4576e384c71890b4df4fa4f1ae76fad3a59d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Nov 2023 10:55:54 +0800 Subject: refactor: iwyu (#26062) --- src/nvim/event/socket.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 62326de075..542fb707fd 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -12,7 +12,6 @@ #include "nvim/event/stream.h" #include "nvim/gettext.h" #include "nvim/log.h" -#include "nvim/macros.h" #include "nvim/main.h" #include "nvim/memory.h" #include "nvim/os/os.h" -- cgit From 38a20dd89f91c45ec8589bf1c50d50732882d38a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 20:58:37 +0800 Subject: build(IWYU): replace most private mappings with pragmas (#26247) --- src/nvim/event/socket.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 542fb707fd..6fe6548f99 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -14,6 +14,7 @@ #include "nvim/log.h" #include "nvim/main.h" #include "nvim/memory.h" +#include "nvim/os/fs.h" #include "nvim/os/os.h" #include "nvim/path.h" -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/event/socket.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 6fe6548f99..f6a950d4ef 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -10,6 +10,7 @@ #include "nvim/event/loop.h" #include "nvim/event/socket.h" #include "nvim/event/stream.h" +#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/log.h" #include "nvim/main.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/event/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event/socket.c') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index f6a950d4ef..e787e023f0 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -5,7 +5,7 @@ #include #include -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/charset.h" #include "nvim/event/loop.h" #include "nvim/event/socket.h" -- cgit