aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-08-19 12:26:08 -0600
committerJosh Rahm <rahm@google.com>2022-08-19 13:06:41 -0600
commita7237662f96933efe29eed8212464571e3778cd0 (patch)
tree27930202726b4251437c8cfa53069f65b4db90dc /src/nvim/os
parent02292344929069ea63c0bb872cc22d552d86b67f (diff)
parentb2f979b30beac67906b2dd717fcb6a34f46f5e54 (diff)
downloadrneovim-tmp.tar.gz
rneovim-tmp.tar.bz2
rneovim-tmp.zip
Merge branch 'master' of https://github.com/neovim/neovim into rahmtmp
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/env.c28
-rw-r--r--src/nvim/os/fs.c27
-rw-r--r--src/nvim/os/input.c4
-rw-r--r--src/nvim/os/pty_conpty_win.h3
-rw-r--r--src/nvim/os/shell.c1
-rw-r--r--src/nvim/os/signal.c2
6 files changed, 24 insertions, 41 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index eaa56ffe63..98ef4bd0f6 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -10,7 +10,6 @@
#include "nvim/charset.h"
#include "nvim/eval.h"
#include "nvim/ex_getln.h"
-#include "nvim/fileio.h"
#include "nvim/macros.h"
#include "nvim/map.h"
#include "nvim/memory.h"
@@ -580,18 +579,18 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
int prefix_len = (prefix == NULL) ? 0 : (int)STRLEN(prefix);
- char_u *src = (char_u *)skipwhite((char *)srcp);
+ char *src = skipwhite((char *)srcp);
dstlen--; // leave one char space for "\,"
while (*src && dstlen > 0) {
// Skip over `=expr`.
if (src[0] == '`' && src[1] == '=') {
- var = src;
+ var = (char_u *)src;
src += 2;
- (void)skip_expr((char **)&src);
+ (void)skip_expr(&src);
if (*src == '`') {
src++;
}
- size_t len = (size_t)(src - var);
+ size_t len = (size_t)(src - (char *)var);
if (len > (size_t)dstlen) {
len = (size_t)dstlen;
}
@@ -608,7 +607,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
// The variable name is copied into dst temporarily, because it may
// be a string in read-only memory and a NUL needs to be appended.
if (*src != '~') { // environment var
- tail = src + 1;
+ tail = (char_u *)src + 1;
var = dst;
int c = dstlen - 1;
@@ -646,11 +645,11 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
|| vim_ispathsep(src[1])
|| vim_strchr(" ,\t\n", src[1]) != NULL) {
var = (char_u *)homedir;
- tail = src + 1;
+ tail = (char_u *)src + 1;
} else { // user directory
#if defined(UNIX)
// Copy ~user to dst[], so we can put a NUL after it.
- tail = src;
+ tail = (char_u *)src;
var = dst;
int c = dstlen - 1;
while (c-- > 0
@@ -723,7 +722,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
tail++;
}
dst += c;
- src = tail;
+ src = (char *)tail;
copy_char = false;
}
if (mustfree) {
@@ -737,17 +736,17 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
// ":edit foo ~ foo".
at_start = false;
if (src[0] == '\\' && src[1] != NUL) {
- *dst++ = *src++;
+ *dst++ = (char_u)(*src++);
dstlen--;
} else if ((src[0] == ' ' || src[0] == ',') && !one) {
at_start = true;
}
if (dstlen > 0) {
- *dst++ = *src++;
+ *dst++ = (char_u)(*src++);
dstlen--;
if (prefix != NULL
- && src - prefix_len >= srcp
+ && src - prefix_len >= (char *)srcp
&& STRNCMP(src - prefix_len, prefix, prefix_len) == 0) {
at_start = true;
}
@@ -1069,9 +1068,8 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si
must_free = true;
size_t usedlen = 0;
size_t flen = strlen(homedir_env_mod);
- char_u *fbuf = NULL;
- (void)modify_fname(":p", false, &usedlen,
- &homedir_env_mod, (char **)&fbuf, &flen);
+ char *fbuf = NULL;
+ (void)modify_fname(":p", false, &usedlen, &homedir_env_mod, &fbuf, &flen);
flen = strlen(homedir_env_mod);
assert(homedir_env_mod != homedir_env);
if (vim_ispathsep(homedir_env_mod[flen - 1])) {
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 901a1bc5a6..0d62a5f5f9 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -144,25 +144,6 @@ bool os_isdir(const char_u *name)
return true;
}
-/// Check if the given path is a directory and is executable.
-/// Gives the same results as `os_isdir()` on Windows.
-///
-/// @return `true` if `name` is a directory and executable.
-bool os_isdir_executable(const char *name)
- FUNC_ATTR_NONNULL_ALL
-{
- int32_t mode = os_getperm(name);
- if (mode < 0) {
- return false;
- }
-
-#ifdef WIN32
- return (S_ISDIR(mode));
-#else
- return (S_ISDIR(mode) && (S_IXUSR & mode));
-#endif
-}
-
/// Check what `name` is:
/// @return NODE_NORMAL: file or directory (or doesn't exist)
/// NODE_WRITABLE: writable device, socket, fifo, etc.
@@ -339,7 +320,7 @@ static bool is_executable_ext(const char *name, char **abspath)
const char *ext_end = ext;
size_t ext_len =
- copy_option_part((char_u **)&ext_end, (char_u *)buf_end,
+ copy_option_part(&ext_end, (char_u *)buf_end,
sizeof(os_buf) - (size_t)(buf_end - os_buf), ENV_SEPSTR);
if (ext_len != 0) {
bool in_pathext = nameext_len == ext_len
@@ -1051,7 +1032,7 @@ int os_remove(const char *path)
bool os_fileinfo(const char *path, FileInfo *file_info)
FUNC_ATTR_NONNULL_ARG(2)
{
- memset(file_info, 0, sizeof(*file_info));
+ CLEAR_POINTER(file_info);
return os_stat(path, &(file_info->stat)) == kLibuvSuccess;
}
@@ -1063,7 +1044,7 @@ bool os_fileinfo(const char *path, FileInfo *file_info)
bool os_fileinfo_link(const char *path, FileInfo *file_info)
FUNC_ATTR_NONNULL_ARG(2)
{
- memset(file_info, 0, sizeof(*file_info));
+ CLEAR_POINTER(file_info);
if (path == NULL) {
return false;
}
@@ -1087,7 +1068,7 @@ bool os_fileinfo_fd(int file_descriptor, FileInfo *file_info)
FUNC_ATTR_NONNULL_ALL
{
uv_fs_t request;
- memset(file_info, 0, sizeof(*file_info));
+ CLEAR_POINTER(file_info);
fs_loop_lock();
bool ok = uv_fs_fstat(&fs_loop,
&request,
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index c47a891c18..bfe6d59dc6 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -8,10 +8,9 @@
#include "nvim/api/private/defs.h"
#include "nvim/ascii.h"
+#include "nvim/autocmd.h"
#include "nvim/event/loop.h"
#include "nvim/event/rstream.h"
-#include "nvim/ex_cmds2.h"
-#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/keycodes.h"
#include "nvim/main.h"
@@ -19,6 +18,7 @@
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/os/input.h"
+#include "nvim/profile.h"
#include "nvim/screen.h"
#include "nvim/state.h"
#include "nvim/ui.h"
diff --git a/src/nvim/os/pty_conpty_win.h b/src/nvim/os/pty_conpty_win.h
index c243db4fa5..15e7c3da0c 100644
--- a/src/nvim/os/pty_conpty_win.h
+++ b/src/nvim/os/pty_conpty_win.h
@@ -1,6 +1,9 @@
#ifndef NVIM_OS_PTY_CONPTY_WIN_H
#define NVIM_OS_PTY_CONPTY_WIN_H
+#include "nvim/lib/kvec.h"
+#include "nvim/os/input.h"
+
#ifndef HPCON
# define HPCON VOID *
#endif
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 8f2018c1f4..dd44cb1ce7 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -25,6 +25,7 @@
#include "nvim/os/shell.h"
#include "nvim/os/signal.h"
#include "nvim/path.h"
+#include "nvim/profile.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 581f025a0f..e592570966 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -9,10 +9,10 @@
#endif
#include "nvim/ascii.h"
+#include "nvim/autocmd.h"
#include "nvim/eval.h"
#include "nvim/event/loop.h"
#include "nvim/event/signal.h"
-#include "nvim/fileio.h"
#include "nvim/globals.h"
#include "nvim/log.h"
#include "nvim/main.h"