From 3b0df1780e2c8526bda5dead18ee7cc45925caba Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:23:44 +0200 Subject: refactor: uncrustify Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`. --- src/nvim/os/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index f4d95e141b..2a248a1e32 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -72,7 +72,7 @@ static bool os_proc_tree_kill_rec(HANDLE process, int sig) } theend: - return (bool)TerminateProcess(process, (unsigned int)sig); + return (bool)TerminateProcess(process, (unsigned)sig); } /// Kills process `pid` and its descendants recursively. bool os_proc_tree_kill(int pid, int sig) -- cgit From cfd4fdfea4d0e68ea50ad412b88b5289ded6fd6f Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 23 May 2023 14:25:10 +0600 Subject: refactor(api): new helper macros Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner. --- src/nvim/os/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 2a248a1e32..98ae251e2b 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -254,7 +254,7 @@ Dictionary os_proc_info(int pid) if (pe.th32ProcessID == (DWORD)pid) { PUT(pinfo, "pid", INTEGER_OBJ(pid)); PUT(pinfo, "ppid", INTEGER_OBJ((int)pe.th32ParentProcessID)); - PUT(pinfo, "name", STRING_OBJ(cstr_to_string(pe.szExeFile))); + PUT(pinfo, "name", CSTR_TO_OBJ(pe.szExeFile)); } return pinfo; -- cgit From f5d12889e80d3369359b8248806694cf6d21f820 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:00:32 +0200 Subject: refactor: adjust headers according to the style guide (#23934) System headers should be included first to prevent naming conflicts. --- src/nvim/os/process.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 98ae251e2b..a636689f97 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -13,14 +13,8 @@ #include #include -#include "nvim/log.h" -#include "nvim/memory.h" -#include "nvim/os/process.h" - #ifdef MSWIN # include - -# include "nvim/api/private/helpers.h" #endif #if defined(__FreeBSD__) // XXX: OpenBSD ? @@ -38,6 +32,14 @@ # include #endif +#include "nvim/log.h" +#include "nvim/memory.h" +#include "nvim/os/process.h" + +#ifdef MSWIN +# include "nvim/api/private/helpers.h" +#endif + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "os/process.c.generated.h" // IWYU pragma: export #endif -- 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/os/process.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index a636689f97..889d1f453f 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.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 - /// OS process functions /// /// psutil is a good reference for cross-platform syscall voodoo: -- cgit From 40139738eb479d0913ec6ce751ca5adfa50ad8c3 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 26 Nov 2023 21:36:02 +0100 Subject: build: enable IWYU on mac --- src/nvim/os/process.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 889d1f453f..7b47ba7020 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -3,18 +3,19 @@ /// psutil is a good reference for cross-platform syscall voodoo: /// https://github.com/giampaolo/psutil/tree/master/psutil/arch +// IWYU pragma: no_include + #include #include #include #include -#include #include #ifdef MSWIN # include #endif -#if defined(__FreeBSD__) // XXX: OpenBSD ? +#if defined(__FreeBSD__) # include # include # include @@ -25,8 +26,13 @@ #endif #if defined(__APPLE__) || defined(BSD) -# include # include + +# include "nvim/macros.h" +#endif + +#if defined(__linux__) +# include #endif #include "nvim/log.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/os/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/process.c') diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 7b47ba7020..d9ec3a7a8a 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -28,7 +28,7 @@ #if defined(__APPLE__) || defined(BSD) # include -# include "nvim/macros.h" +# include "nvim/macros_defs.h" #endif #if defined(__linux__) -- cgit