From 166b149d5b473f277c63e64ced03c40df44ac3c9 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 16:30:32 +0100 Subject: refactor(build): remove unused stdlib function and include checks In addition: merge some checks for the same feature into one test_compile. This reduces the total number of test compiles which speeds up the cmake configure stage. --- src/nvim/os/users.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index ef2986246b..411ba91fa7 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -15,7 +15,7 @@ #include "nvim/os/os.h" #include "nvim/types.h" #include "nvim/vim.h" -#ifdef HAVE_PWD_H +#ifdef HAVE_PWD_FUNCS # include #endif #ifdef MSWIN @@ -50,7 +50,7 @@ int os_get_usernames(garray_T *users) } ga_init(users, sizeof(char *), 20); -#if defined(HAVE_GETPWENT) && defined(HAVE_PWD_H) +#ifdef HAVE_PWD_FUNCS { struct passwd *pw; @@ -81,7 +81,7 @@ int os_get_usernames(garray_T *users) } } #endif -#if defined(HAVE_GETPWNAM) +#ifdef HAVE_PWD_FUNCS { const char *user_env = os_getenv("USER"); @@ -141,7 +141,7 @@ int os_get_username(char *s, size_t len) /// @return OK if a username was found, else FAIL. int os_get_uname(uv_uid_t uid, char *s, size_t len) { -#if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID) +#ifdef HAVE_PWD_FUNCS struct passwd *pw; if ((pw = getpwuid(uid)) != NULL // NOLINT(runtime/threadsafe_fn) @@ -159,7 +159,7 @@ int os_get_uname(uv_uid_t uid, char *s, size_t len) /// Caller must free() the returned string. char *os_get_userdir(const char *name) { -#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H) +#ifdef HAVE_PWD_FUNCS if (name == NULL || *name == NUL) { return NULL; } -- cgit From 09a17f91d0d362c6e58bfdbe3ccdeacffb0b44b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Oct 2023 10:45:33 +0800 Subject: refactor: move cmdline completion types to cmdexpand_defs.h (#25465) --- src/nvim/os/users.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index 411ba91fa7..b23d2b7b13 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -10,10 +10,10 @@ #include "auto/config.h" #include "nvim/ascii.h" +#include "nvim/cmdexpand_defs.h" #include "nvim/garray.h" #include "nvim/memory.h" #include "nvim/os/os.h" -#include "nvim/types.h" #include "nvim/vim.h" #ifdef HAVE_PWD_FUNCS # include -- 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/users.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index b23d2b7b13..b61dcd1e4b 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.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 - // users.c -- operating system user information #include -- cgit From a6e3d93421ba13c407a96fac9cc01fa41ec7ad98 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 16 Nov 2023 10:59:11 +0100 Subject: refactor: enable formatting for ternaries This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators. --- src/nvim/os/users.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index b61dcd1e4b..f0666435cc 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -27,7 +27,7 @@ static garray_T ga_users = GA_EMPTY_INIT_VALUE; static void add_user(garray_T *users, char *user, bool need_copy) { char *user_copy = (user != NULL && need_copy) - ? xstrdup(user) : user; + ? xstrdup(user) : user; if (user_copy == NULL || *user_copy == NUL) { if (need_copy) { -- 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/users.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index f0666435cc..5f77b5a6ee 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -6,12 +6,12 @@ #include #include "auto/config.h" -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/cmdexpand_defs.h" #include "nvim/garray.h" #include "nvim/memory.h" #include "nvim/os/os.h" -#include "nvim/vim.h" +#include "nvim/vim_defs.h" #ifdef HAVE_PWD_FUNCS # include #endif -- cgit From a6cba103cebce535279db197f9efeb34e9d1171f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 29 Nov 2023 20:32:40 +0800 Subject: refactor: move some constants out of vim_defs.h (#26298) --- src/nvim/os/users.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/os/users.c') diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index 5f77b5a6ee..ae0994a73f 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -17,6 +17,9 @@ #endif #ifdef MSWIN # include + +# include "nvim/mbyte.h" +# include "nvim/message.h" #endif // All user names (for ~user completion as done by shell). -- cgit