diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
commit | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch) | |
tree | cd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/os/users.c | |
parent | eaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-aucmd_textputpost.tar.gz rneovim-aucmd_textputpost.tar.bz2 rneovim-aucmd_textputpost.zip |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/os/users.c')
-rw-r--r-- | src/nvim/os/users.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index ef2986246b..ae0994a73f 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 <stdbool.h> @@ -9,17 +6,20 @@ #include <uv.h> #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/types.h" -#include "nvim/vim.h" -#ifdef HAVE_PWD_H +#include "nvim/vim_defs.h" +#ifdef HAVE_PWD_FUNCS # include <pwd.h> #endif #ifdef MSWIN # include <lm.h> + +# include "nvim/mbyte.h" +# include "nvim/message.h" #endif // All user names (for ~user completion as done by shell). @@ -30,7 +30,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) { @@ -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; } |