aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-02-27 16:30:32 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2023-03-03 14:19:46 +0100
commit166b149d5b473f277c63e64ced03c40df44ac3c9 (patch)
treeaf1b66f0a4b0b13ad128d0cef106aef5bfbfc704 /src/nvim/os
parentfbaf5bde55d42869ed6d9e9fc072110ac9976c66 (diff)
downloadrneovim-166b149d5b473f277c63e64ced03c40df44ac3c9.tar.gz
rneovim-166b149d5b473f277c63e64ced03c40df44ac3c9.tar.bz2
rneovim-166b149d5b473f277c63e64ced03c40df44ac3c9.zip
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.
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/os_defs.h5
-rw-r--r--src/nvim/os/shell.c4
-rw-r--r--src/nvim/os/users.c10
3 files changed, 9 insertions, 10 deletions
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h
index f86c0d3483..9e201f1dfa 100644
--- a/src/nvim/os/os_defs.h
+++ b/src/nvim/os/os_defs.h
@@ -36,10 +36,9 @@
// Command-processing buffer. Use large buffers for all platforms.
#define CMDBUFFSIZE 1024
-// Note: Some systems need both string.h and strings.h (Savage). However,
-// some systems can't handle both, only use string.h in that case.
+// Note: Some systems need both string.h and strings.h (Savage).
#include <string.h>
-#if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
+#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index f1e2c5440f..f7d1154169 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -399,8 +399,8 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
fclose(fd);
return FAIL;
}
-#if SIZEOF_LONG_LONG > SIZEOF_SIZE_T
- assert(templen <= (long long)SIZE_MAX); // NOLINT(runtime/int)
+#if 8 > SIZEOF_SIZE_T
+ assert(templen <= SIZE_MAX); // NOLINT(runtime/int)
#endif
len = (size_t)templen;
fseek(fd, 0L, SEEK_SET);
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 <pwd.h>
#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;
}