mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
refactor: format files with uncrustify #15663
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Uncrustify-0.73.0-162-ac9b0f48
|
||||
# Uncrustify-0.73.0-164-c9a58467
|
||||
|
||||
#
|
||||
# General options
|
||||
|
@ -2,14 +2,13 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/os/os.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/loop.h"
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/multiqueue.h"
|
||||
@ -104,8 +102,7 @@ MultiQueue *multiqueue_new_child(MultiQueue *parent)
|
||||
return multiqueue_new(parent, NULL, NULL);
|
||||
}
|
||||
|
||||
static MultiQueue *multiqueue_new(MultiQueue *parent, PutCallback put_cb,
|
||||
void *data)
|
||||
static MultiQueue *multiqueue_new(MultiQueue *parent, PutCallback put_cb, void *data)
|
||||
{
|
||||
MultiQueue *rv = xmalloc(sizeof(MultiQueue));
|
||||
QUEUE_INIT(&rv->headtail);
|
||||
|
@ -3,20 +3,19 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/os/shell.h"
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/os/process.h"
|
||||
#include "nvim/os/pty_process.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/os/shell.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "event/process.c.generated.h"
|
||||
@ -139,8 +138,7 @@ void process_teardown(Loop *loop) FUNC_ATTR_NONNULL_ALL
|
||||
}
|
||||
|
||||
// Wait until all children exit and all close events are processed.
|
||||
LOOP_PROCESS_EVENTS_UNTIL(
|
||||
loop, loop->events, -1,
|
||||
LOOP_PROCESS_EVENTS_UNTIL(loop, loop->events, -1,
|
||||
kl_empty(loop->children) && multiqueue_empty(loop->events));
|
||||
pty_process_teardown(loop);
|
||||
}
|
||||
|
@ -2,19 +2,18 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "event/rstream.c.generated.h"
|
||||
@ -160,8 +159,7 @@ static void fread_idle_cb(uv_idle_t *handle)
|
||||
}
|
||||
|
||||
// Synchronous read
|
||||
uv_fs_read(
|
||||
handle->loop,
|
||||
uv_fs_read(handle->loop,
|
||||
&req,
|
||||
stream->fd,
|
||||
&stream->uvbuf,
|
||||
|
@ -3,30 +3,28 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/socket.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/socket.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "event/socket.c.generated.h"
|
||||
#endif
|
||||
|
||||
int socket_watcher_init(Loop *loop, SocketWatcher *watcher,
|
||||
const char *endpoint)
|
||||
int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
xstrlcpy(watcher->addr, endpoint, sizeof(watcher->addr));
|
||||
@ -203,9 +201,8 @@ static void connect_cb(uv_connect_t *req, int status)
|
||||
}
|
||||
}
|
||||
|
||||
bool socket_connect(Loop *loop, Stream *stream,
|
||||
bool is_tcp, const char *address,
|
||||
int timeout, const char **error)
|
||||
bool socket_connect(Loop *loop, Stream *stream, bool is_tcp, const char *address, int timeout,
|
||||
const char **error)
|
||||
{
|
||||
bool success = false;
|
||||
int status;
|
||||
@ -243,7 +240,6 @@ tcp_retry:
|
||||
uv_tcp_nodelay(tcp, true);
|
||||
uv_tcp_connect(&req, tcp, addrinfo->ai_addr, connect_cb);
|
||||
uv_stream = (uv_stream_t *)tcp;
|
||||
|
||||
} else {
|
||||
uv_pipe_t *pipe = &stream->uv.pipe;
|
||||
uv_pipe_init(&loop->uv, pipe, 0);
|
||||
|
@ -2,15 +2,14 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/event/stream.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
#ifdef WIN32
|
||||
# include "nvim/os/os_win_console.h"
|
||||
#endif
|
||||
|
@ -2,7 +2,6 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/event/loop.h"
|
||||
@ -23,8 +22,7 @@ void time_watcher_init(Loop *loop, TimeWatcher *watcher, void *data)
|
||||
watcher->blockable = false;
|
||||
}
|
||||
|
||||
void time_watcher_start(TimeWatcher *watcher, time_cb cb, uint64_t timeout,
|
||||
uint64_t repeat)
|
||||
void time_watcher_start(TimeWatcher *watcher, time_cb cb, uint64_t timeout, uint64_t repeat)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
watcher->cb = cb;
|
||||
|
@ -2,17 +2,16 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#define DEFAULT_MAXMEM 1024 * 1024 * 2000
|
||||
|
||||
@ -117,10 +116,7 @@ err:
|
||||
/// @param cb Pointer to function that will be responsible for freeing
|
||||
/// the buffer data(passing 'free' will work as expected).
|
||||
/// @return The allocated WBuffer instance
|
||||
WBuffer *wstream_new_buffer(char *data,
|
||||
size_t size,
|
||||
size_t refcount,
|
||||
wbuffer_data_finalizer cb)
|
||||
WBuffer *wstream_new_buffer(char *data, size_t size, size_t refcount, wbuffer_data_finalizer cb)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
WBuffer *rv = xmalloc(sizeof(WBuffer));
|
||||
|
@ -7,10 +7,10 @@
|
||||
#include <stdint.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/os/dl.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/os/dl.h"
|
||||
#include "nvim/os/os.h"
|
||||
|
||||
/// possible function prototypes that can be called by os_libcall()
|
||||
/// int -> int
|
||||
@ -38,12 +38,8 @@ typedef int (*int_int_fn)(int i);
|
||||
/// not NULL. NULL when using `int_out`.
|
||||
/// @param[out] int_out the output integer param
|
||||
/// @return true on success, false on failure
|
||||
bool os_libcall(const char *libname,
|
||||
const char *funcname,
|
||||
const char *argv,
|
||||
int argi,
|
||||
char **str_out,
|
||||
int *int_out)
|
||||
bool os_libcall(const char *libname, const char *funcname, const char *argv, int argi,
|
||||
char **str_out, int *int_out)
|
||||
{
|
||||
if (!libname || !funcname) {
|
||||
return false;
|
||||
|
@ -6,20 +6,20 @@
|
||||
#include <assert.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/version.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/version.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8
|
||||
@ -219,7 +219,9 @@ size_t os_get_fullenv_size(void)
|
||||
|
||||
void os_free_fullenv(char **env)
|
||||
{
|
||||
if (!env) { return; }
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
for (char **it = env; *it; it++) {
|
||||
XFREE_CLEAR(*it);
|
||||
}
|
||||
@ -566,11 +568,7 @@ void expand_env(char_u *src, char_u *dst, int dstlen)
|
||||
/// @param esc Escape spaces in expanded variables
|
||||
/// @param one `srcp` is a single filename
|
||||
/// @param prefix Start again after this (can be NULL)
|
||||
void expand_env_esc(char_u *restrict srcp,
|
||||
char_u *restrict dst,
|
||||
int dstlen,
|
||||
bool esc,
|
||||
bool one,
|
||||
void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, bool esc, bool one,
|
||||
char_u *prefix)
|
||||
FUNC_ATTR_NONNULL_ARG(1, 2)
|
||||
{
|
||||
@ -721,8 +719,9 @@ void expand_env_esc(char_u *restrict srcp,
|
||||
#if defined(BACKSLASH_IN_FILENAME)
|
||||
&& dst[-1] != ':'
|
||||
#endif
|
||||
&& vim_ispathsep(*tail))
|
||||
&& vim_ispathsep(*tail)) {
|
||||
++tail;
|
||||
}
|
||||
dst += c;
|
||||
src = tail;
|
||||
copy_char = false;
|
||||
@ -826,11 +825,8 @@ static char *remove_tail(char *path, char *pend, char *dirname)
|
||||
/// @param[out] len Location where current directory length should be saved.
|
||||
///
|
||||
/// @return Next iter argument value or NULL when iteration should stop.
|
||||
const void *vim_env_iter(const char delim,
|
||||
const char *const val,
|
||||
const void *const iter,
|
||||
const char **const dir,
|
||||
size_t *const len)
|
||||
const void *vim_env_iter(const char delim, const char *const val, const void *const iter,
|
||||
const char **const dir, size_t *const len)
|
||||
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
const char *varval = (const char *)iter;
|
||||
@ -861,11 +857,8 @@ const void *vim_env_iter(const char delim,
|
||||
/// @param[out] len Location where current directory length should be saved.
|
||||
///
|
||||
/// @return Next iter argument value or NULL when iteration should stop.
|
||||
const void *vim_env_iter_rev(const char delim,
|
||||
const char *const val,
|
||||
const void *const iter,
|
||||
const char **const dir,
|
||||
size_t *const len)
|
||||
const void *vim_env_iter_rev(const char delim, const char *const val, const void *const iter,
|
||||
const char **const dir, size_t *const len)
|
||||
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
const char *varend = (const char *)iter;
|
||||
@ -955,8 +948,7 @@ char *vim_getenv(const char *name)
|
||||
// Find runtime path relative to the nvim binary: ../share/nvim/runtime
|
||||
if (vim_path == NULL) {
|
||||
vim_get_prefix_from_exepath(exe_name);
|
||||
if (append_path(
|
||||
exe_name,
|
||||
if (append_path(exe_name,
|
||||
"share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR,
|
||||
MAXPATHL) == OK) {
|
||||
vim_path = exe_name; // -V507
|
||||
@ -1043,8 +1035,8 @@ char *vim_getenv(const char *name)
|
||||
/// a list of them.
|
||||
///
|
||||
/// @return length of the string put into dst, does not include NUL byte.
|
||||
size_t home_replace(const buf_T *const buf, const char_u *src,
|
||||
char_u *const dst, size_t dstlen, const bool one)
|
||||
size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst, size_t dstlen,
|
||||
const bool one)
|
||||
FUNC_ATTR_NONNULL_ARG(3)
|
||||
{
|
||||
size_t dirlen = 0;
|
||||
|
@ -8,9 +8,9 @@
|
||||
/// replacement.
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "auto/config.h"
|
||||
|
||||
@ -20,13 +20,13 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/os/fileio.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/os/fileio.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/rbuffer.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/fileio.c.generated.h"
|
||||
@ -44,8 +44,8 @@
|
||||
/// does not have kFileCreate\*).
|
||||
///
|
||||
/// @return Error code, or 0 on success. @see os_strerror()
|
||||
int file_open(FileDescriptor *const ret_fp, const char *const fname,
|
||||
const int flags, const int mode)
|
||||
int file_open(FileDescriptor *const ret_fp, const char *const fname, const int flags,
|
||||
const int mode)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
int os_open_flags = 0;
|
||||
@ -99,8 +99,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname,
|
||||
/// FILE_WRITE_ONLY or FILE_READ_ONLY is required.
|
||||
///
|
||||
/// @return Error code (@see os_strerror()) or 0. Currently always returns 0.
|
||||
int file_open_fd(FileDescriptor *const ret_fp, const int fd,
|
||||
const int flags)
|
||||
int file_open_fd(FileDescriptor *const ret_fp, const int fd, const int flags)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
ret_fp->wr = !!(flags & (kFileCreate
|
||||
@ -131,8 +130,8 @@ int file_open_fd(FileDescriptor *const ret_fp, const int fd,
|
||||
/// does not have kFileCreate\*).
|
||||
///
|
||||
/// @return [allocated] Opened file or NULL in case of error.
|
||||
FileDescriptor *file_open_new(int *const error, const char *const fname,
|
||||
const int flags, const int mode)
|
||||
FileDescriptor *file_open_new(int *const error, const char *const fname, const int flags,
|
||||
const int mode)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
FileDescriptor *const fp = xmalloc(sizeof(*fp));
|
||||
@ -152,8 +151,7 @@ FileDescriptor *file_open_new(int *const error, const char *const fname,
|
||||
/// does not have FILE_CREATE\*).
|
||||
///
|
||||
/// @return [allocated] Opened file or NULL in case of error.
|
||||
FileDescriptor *file_open_fd_new(int *const error, const int fd,
|
||||
const int flags)
|
||||
FileDescriptor *file_open_fd_new(int *const error, const int fd, const int flags)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
FileDescriptor *const fp = xmalloc(sizeof(*fp));
|
||||
@ -277,8 +275,7 @@ static void file_rb_write_full_cb(RBuffer *const rv, FileDescriptor *const fp)
|
||||
/// bytes.
|
||||
///
|
||||
/// @return error_code (< 0) or number of bytes read.
|
||||
ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf,
|
||||
const size_t size)
|
||||
ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf, const size_t size)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
assert(!fp->wr);
|
||||
@ -362,8 +359,7 @@ ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf,
|
||||
/// @param[in] size Amount of bytes to write.
|
||||
///
|
||||
/// @return Number of bytes written or libuv error code (< 0).
|
||||
ptrdiff_t file_write(FileDescriptor *const fp, const char *const buf,
|
||||
const size_t size)
|
||||
ptrdiff_t file_write(FileDescriptor *const fp, const char *const buf, const size_t size)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
assert(fp->wr);
|
||||
@ -392,8 +388,8 @@ ptrdiff_t file_skip(FileDescriptor *const fp, const size_t size)
|
||||
assert(!fp->wr);
|
||||
size_t read_bytes = 0;
|
||||
do {
|
||||
const ptrdiff_t new_read_bytes = file_read(
|
||||
fp, skipbuf, MIN(size - read_bytes, sizeof(skipbuf)));
|
||||
const ptrdiff_t new_read_bytes =
|
||||
file_read(fp, skipbuf, MIN(size - read_bytes, sizeof(skipbuf)));
|
||||
if (new_read_bytes < 0) {
|
||||
return new_read_bytes;
|
||||
} else if (new_read_bytes == 0) {
|
||||
|
@ -2,12 +2,12 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
// fs.c -- filesystem access
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "auto/config.h"
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/os_defs.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/os_defs.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/strings.h"
|
||||
|
||||
@ -553,8 +553,8 @@ os_dup_dup:
|
||||
/// @param[in] non_blocking Do not restart syscall if EAGAIN was encountered.
|
||||
///
|
||||
/// @return Number of bytes read or libuv error code (< 0).
|
||||
ptrdiff_t os_read(const int fd, bool *const ret_eof, char *const ret_buf,
|
||||
const size_t size, const bool non_blocking)
|
||||
ptrdiff_t os_read(const int fd, bool *const ret_eof, char *const ret_buf, const size_t size,
|
||||
const bool non_blocking)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
*ret_eof = false;
|
||||
@ -609,8 +609,8 @@ ptrdiff_t os_read(const int fd, bool *const ret_eof, char *const ret_buf,
|
||||
/// @param[in] non_blocking Do not restart syscall if EAGAIN was encountered.
|
||||
///
|
||||
/// @return Number of bytes read or libuv error code (< 0).
|
||||
ptrdiff_t os_readv(const int fd, bool *const ret_eof, struct iovec *iov,
|
||||
size_t iov_size, const bool non_blocking)
|
||||
ptrdiff_t os_readv(const int fd, bool *const ret_eof, struct iovec *iov, size_t iov_size,
|
||||
const bool non_blocking)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
*ret_eof = false;
|
||||
@ -668,8 +668,7 @@ ptrdiff_t os_readv(const int fd, bool *const ret_eof, struct iovec *iov,
|
||||
/// @param[in] non_blocking Do not restart syscall if EAGAIN was encountered.
|
||||
///
|
||||
/// @return Number of bytes written or libuv error code (< 0).
|
||||
ptrdiff_t os_write(const int fd, const char *const buf, const size_t size,
|
||||
const bool non_blocking)
|
||||
ptrdiff_t os_write(const int fd, const char *const buf, const size_t size, const bool non_blocking)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (buf == NULL) {
|
||||
@ -884,8 +883,7 @@ int os_mkdir(const char *path, int32_t mode)
|
||||
/// of the higher level directories.
|
||||
///
|
||||
/// @return `0` for success, libuv error code for failure.
|
||||
int os_mkdir_recurse(const char *const dir, int32_t mode,
|
||||
char **const failed_dir)
|
||||
int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_dir)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
// Get end of directory name in "dir".
|
||||
@ -1058,8 +1056,7 @@ bool os_fileinfo_fd(int file_descriptor, FileInfo *file_info)
|
||||
/// Compare the inodes of two FileInfos
|
||||
///
|
||||
/// @return `true` if the two FileInfos represent the same file.
|
||||
bool os_fileinfo_id_equal(const FileInfo *file_info_1,
|
||||
const FileInfo *file_info_2)
|
||||
bool os_fileinfo_id_equal(const FileInfo *file_info_1, const FileInfo *file_info_2)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
return file_info_1->stat.st_ino == file_info_2->stat.st_ino
|
||||
@ -1149,8 +1146,7 @@ bool os_fileid_equal(const FileID *file_id_1, const FileID *file_id_2)
|
||||
/// @param file_id Pointer to a `FileID`
|
||||
/// @param file_info Pointer to a `FileInfo`
|
||||
/// @return `true` if the `FileID` and the `FileInfo` represent te same file.
|
||||
bool os_fileid_equal_fileinfo(const FileID *file_id,
|
||||
const FileInfo *file_info)
|
||||
bool os_fileid_equal_fileinfo(const FileID *file_id, const FileInfo *file_info)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
return file_id->inode == file_info->stat.st_ino
|
||||
@ -1219,8 +1215,7 @@ char *os_resolve_shortcut(const char *fname)
|
||||
EMSG2("utf8_to_utf16 failed: %d", r);
|
||||
} else if (p != NULL) {
|
||||
// Get a pointer to the IPersistFile interface.
|
||||
hr = pslw->lpVtbl->QueryInterface(
|
||||
pslw, &IID_IPersistFile, (void **)&ppf);
|
||||
hr = pslw->lpVtbl->QueryInterface(pslw, &IID_IPersistFile, (void **)&ppf);
|
||||
if (hr != S_OK) {
|
||||
goto shortcut_errorw;
|
||||
}
|
||||
|
@ -2,28 +2,27 @@
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/keymap.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/ex_cmds2.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/keymap.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/msgpack_rpc/channel.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#define READ_BUFFER_SIZE 0xfff
|
||||
#define INPUT_BUFFER_SIZE (READ_BUFFER_SIZE * 4)
|
||||
@ -102,8 +101,7 @@ static void create_cursorhold_event(bool events_enabled)
|
||||
///
|
||||
/// wait until either the input buffer is non-empty or , if `events` is not NULL
|
||||
/// until `events` is non-empty.
|
||||
int os_inchar(uint8_t *buf, int maxlen, int ms, int tb_change_cnt,
|
||||
MultiQueue *events)
|
||||
int os_inchar(uint8_t *buf, int maxlen, int ms, int tb_change_cnt, MultiQueue *events)
|
||||
{
|
||||
if (maxlen && rbuffer_size(input_buffer)) {
|
||||
return (int)rbuffer_read(input_buffer, (char *)buf, (size_t)maxlen);
|
||||
@ -301,8 +299,7 @@ static uint8_t check_multiclick(int code, int grid, int row, int col)
|
||||
|
||||
// Mouse event handling code(Extract row/col if available and detect multiple
|
||||
// clicks)
|
||||
static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
|
||||
unsigned int bufsize)
|
||||
static unsigned int handle_mouse_event(char **ptr, uint8_t *buf, unsigned int bufsize)
|
||||
{
|
||||
int mouse_code = 0;
|
||||
int type = 0;
|
||||
@ -364,8 +361,7 @@ static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
|
||||
return bufsize;
|
||||
}
|
||||
|
||||
size_t input_enqueue_mouse(int code, uint8_t modifier,
|
||||
int grid, int row, int col)
|
||||
size_t input_enqueue_mouse(int code, uint8_t modifier, int grid, int row, int col)
|
||||
{
|
||||
modifier |= check_multiclick(code, grid, row, col);
|
||||
uint8_t buf[7], *p = buf;
|
||||
@ -437,8 +433,7 @@ bool input_available(void)
|
||||
return rbuffer_size(input_buffer) != 0;
|
||||
}
|
||||
|
||||
static void input_read_cb(Stream *stream, RBuffer *buf, size_t c, void *data,
|
||||
bool at_eof)
|
||||
static void input_read_cb(Stream *stream, RBuffer *buf, size_t c, void *data, bool at_eof)
|
||||
{
|
||||
if (at_eof) {
|
||||
input_done();
|
||||
|
@ -1,9 +1,9 @@
|
||||
// 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
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/os/os_win_console.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/os_win_console.c.generated.h"
|
||||
|
@ -23,16 +23,16 @@
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(BSD)
|
||||
# include <sys/sysctl.h>
|
||||
# include <pwd.h>
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/os/process.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/os_defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/os/process.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/process.c.generated.h"
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/pty_conpty_win.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifndef EXTENDED_STARTUPINFO_PRESENT
|
||||
# define EXTENDED_STARTUPINFO_PRESENT 0x00080000
|
||||
@ -54,8 +54,7 @@ TriState os_dyn_conpty_init(void)
|
||||
return kTrue;
|
||||
}
|
||||
|
||||
conpty_t *os_conpty_init(char **in_name, char **out_name,
|
||||
uint16_t width, uint16_t height)
|
||||
conpty_t *os_conpty_init(char **in_name, char **out_name, uint16_t width, uint16_t height)
|
||||
{
|
||||
static int count = 0;
|
||||
conpty_t *conpty_object = xcalloc(1, sizeof(*conpty_object));
|
||||
@ -71,8 +70,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name,
|
||||
snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-in-%d-%d",
|
||||
os_get_pid(), count);
|
||||
*in_name = xstrdup(buf);
|
||||
if ((in_read = CreateNamedPipeA(
|
||||
*in_name,
|
||||
if ((in_read = CreateNamedPipeA(*in_name,
|
||||
mode,
|
||||
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
|
||||
1,
|
||||
@ -86,8 +84,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name,
|
||||
snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-out-%d-%d",
|
||||
os_get_pid(), count);
|
||||
*out_name = xstrdup(buf);
|
||||
if ((out_write = CreateNamedPipeA(
|
||||
*out_name,
|
||||
if ((out_write = CreateNamedPipeA(*out_name,
|
||||
mode,
|
||||
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
|
||||
1,
|
||||
@ -113,16 +110,14 @@ conpty_t *os_conpty_init(char **in_name, char **out_name,
|
||||
InitializeProcThreadAttributeList(NULL, 1, 0, & bytes_required);
|
||||
conpty_object->si_ex.lpAttributeList =
|
||||
(PPROC_THREAD_ATTRIBUTE_LIST)xmalloc(bytes_required);
|
||||
if (!InitializeProcThreadAttributeList(
|
||||
conpty_object->si_ex.lpAttributeList,
|
||||
if (!InitializeProcThreadAttributeList(conpty_object->si_ex.lpAttributeList,
|
||||
1,
|
||||
0,
|
||||
&bytes_required)) {
|
||||
emsg = "InitializeProcThreadAttributeList failed";
|
||||
goto failed;
|
||||
}
|
||||
if (!UpdateProcThreadAttribute(
|
||||
conpty_object->si_ex.lpAttributeList,
|
||||
if (!UpdateProcThreadAttribute(conpty_object->si_ex.lpAttributeList,
|
||||
0,
|
||||
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
|
||||
conpty_object->pty,
|
||||
@ -150,13 +145,11 @@ finished:
|
||||
return conpty_object;
|
||||
}
|
||||
|
||||
bool os_conpty_spawn(conpty_t *conpty_object, HANDLE *process_handle,
|
||||
wchar_t *name, wchar_t *cmd_line, wchar_t *cwd,
|
||||
wchar_t *env)
|
||||
bool os_conpty_spawn(conpty_t *conpty_object, HANDLE *process_handle, wchar_t *name,
|
||||
wchar_t *cmd_line, wchar_t *cwd, wchar_t *env)
|
||||
{
|
||||
PROCESS_INFORMATION pi = { 0 };
|
||||
if (!CreateProcessW(
|
||||
name,
|
||||
if (!CreateProcessW(name,
|
||||
cmd_line,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -172,8 +165,7 @@ bool os_conpty_spawn(conpty_t *conpty_object, HANDLE *process_handle,
|
||||
return true;
|
||||
}
|
||||
|
||||
void os_conpty_set_size(conpty_t *conpty_object,
|
||||
uint16_t width, uint16_t height)
|
||||
void os_conpty_set_size(conpty_t *conpty_object, uint16_t width, uint16_t height)
|
||||
{
|
||||
assert(width <= SHRT_MAX);
|
||||
assert(height <= SHRT_MAX);
|
||||
|
@ -5,11 +5,10 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
|
||||
// forkpty is not in POSIX, so headers are platform-specific
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
@ -26,15 +25,14 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/lib/klist.h"
|
||||
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/event/wstream.h"
|
||||
#include "nvim/event/process.h"
|
||||
#include "nvim/os/pty_process_unix.h"
|
||||
#include "nvim/lib/klist.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/pty_process_unix.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/pty_process_unix.c.generated.h"
|
||||
|
@ -4,15 +4,14 @@
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <winpty_constants.h>
|
||||
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8
|
||||
#include "nvim/os/pty_process_win.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/pty_conpty_win.h"
|
||||
#include "nvim/os/pty_process_win.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/pty_process_win.c.generated.h"
|
||||
@ -94,8 +93,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
|
||||
|
||||
if (!proc->in.closed) {
|
||||
in_req = xmalloc(sizeof(uv_connect_t));
|
||||
uv_pipe_connect(
|
||||
in_req,
|
||||
uv_pipe_connect(in_req,
|
||||
&proc->in.uv.pipe,
|
||||
in_name,
|
||||
pty_process_connect_cb);
|
||||
@ -103,8 +101,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
|
||||
|
||||
if (!proc->out.closed) {
|
||||
out_req = xmalloc(sizeof(uv_connect_t));
|
||||
uv_pipe_connect(
|
||||
out_req,
|
||||
uv_pipe_connect(out_req,
|
||||
&proc->out.uv.pipe,
|
||||
out_name,
|
||||
pty_process_connect_cb);
|
||||
@ -146,8 +143,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
spawncfg = winpty_spawn_config_new(
|
||||
WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN,
|
||||
spawncfg = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN,
|
||||
NULL, // Optional application name
|
||||
cmd_line,
|
||||
cwd,
|
||||
@ -176,8 +172,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
|
||||
}
|
||||
proc->pid = (int)GetProcessId(process_handle);
|
||||
|
||||
if (!RegisterWaitForSingleObject(
|
||||
&ptyproc->finish_wait,
|
||||
if (!RegisterWaitForSingleObject(&ptyproc->finish_wait,
|
||||
process_handle,
|
||||
pty_process_finish1,
|
||||
ptyproc,
|
||||
@ -235,8 +230,7 @@ const char *pty_process_tty_name(PtyProcess *ptyproc)
|
||||
return "?";
|
||||
}
|
||||
|
||||
void pty_process_resize(PtyProcess *ptyproc, uint16_t width,
|
||||
uint16_t height)
|
||||
void pty_process_resize(PtyProcess *ptyproc, uint16_t width, uint16_t height)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (ptyproc->type == kConpty
|
||||
@ -454,15 +448,24 @@ int translate_winpty_error(int winpty_errno)
|
||||
}
|
||||
|
||||
switch (winpty_errno) {
|
||||
case WINPTY_ERROR_OUT_OF_MEMORY: return UV_ENOMEM;
|
||||
case WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED: return UV_EAI_FAIL;
|
||||
case WINPTY_ERROR_LOST_CONNECTION: return UV_ENOTCONN;
|
||||
case WINPTY_ERROR_AGENT_EXE_MISSING: return UV_ENOENT;
|
||||
case WINPTY_ERROR_UNSPECIFIED: return UV_UNKNOWN;
|
||||
case WINPTY_ERROR_AGENT_DIED: return UV_ESRCH;
|
||||
case WINPTY_ERROR_AGENT_TIMEOUT: return UV_ETIMEDOUT;
|
||||
case WINPTY_ERROR_AGENT_CREATION_FAILED: return UV_EAI_FAIL;
|
||||
default: return UV_UNKNOWN;
|
||||
case WINPTY_ERROR_OUT_OF_MEMORY:
|
||||
return UV_ENOMEM;
|
||||
case WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED:
|
||||
return UV_EAI_FAIL;
|
||||
case WINPTY_ERROR_LOST_CONNECTION:
|
||||
return UV_ENOTCONN;
|
||||
case WINPTY_ERROR_AGENT_EXE_MISSING:
|
||||
return UV_ENOENT;
|
||||
case WINPTY_ERROR_UNSPECIFIED:
|
||||
return UV_UNKNOWN;
|
||||
case WINPTY_ERROR_AGENT_DIED:
|
||||
return UV_ESRCH;
|
||||
case WINPTY_ERROR_AGENT_TIMEOUT:
|
||||
return UV_ETIMEDOUT;
|
||||
case WINPTY_ERROR_AGENT_CREATION_FAILED:
|
||||
return UV_EAI_FAIL;
|
||||
default:
|
||||
return UV_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,36 +1,35 @@
|
||||
// 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
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/ex_cmds.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/lib/kvec.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/event/libuv_process.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
#include "nvim/ex_cmds.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/option_defs.h"
|
||||
#include "nvim/os/shell.h"
|
||||
#include "nvim/os/signal.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/types.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/screen.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/option_defs.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#define DYNAMIC_BUFFER_INIT { NULL, 0, 0 }
|
||||
#define NS_1_SECOND 1000000000U // 1 second, in nanoseconds
|
||||
@ -47,8 +46,7 @@ typedef struct {
|
||||
# include "os/shell.c.generated.h"
|
||||
#endif
|
||||
|
||||
static void save_patterns(int num_pat, char_u **pat, int *num_file,
|
||||
char_u ***file)
|
||||
static void save_patterns(int num_pat, char_u **pat, int *num_file, char_u ***file)
|
||||
{
|
||||
*file = xmalloc((size_t)num_pat * sizeof(char_u *));
|
||||
for (int i = 0; i < num_pat; i++) {
|
||||
@ -99,8 +97,7 @@ static bool have_dollars(int num, char_u **file)
|
||||
/// copied into *file.
|
||||
///
|
||||
/// @returns OK for success or FAIL for error.
|
||||
int os_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
char_u ***file, int flags)
|
||||
int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)
|
||||
FUNC_ATTR_NONNULL_ARG(3)
|
||||
FUNC_ATTR_NONNULL_ARG(4)
|
||||
{
|
||||
@ -705,22 +702,14 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
|
||||
/// returned buffer is not NULL)
|
||||
/// @return the return code of the process, -1 if the process couldn't be
|
||||
/// started properly
|
||||
int os_system(char **argv,
|
||||
const char *input,
|
||||
size_t len,
|
||||
char **output,
|
||||
int os_system(char **argv, const char *input, size_t len, char **output,
|
||||
size_t *nread) FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
return do_os_system(argv, input, len, output, nread, true, false);
|
||||
}
|
||||
|
||||
static int do_os_system(char **argv,
|
||||
const char *input,
|
||||
size_t len,
|
||||
char **output,
|
||||
size_t *nread,
|
||||
bool silent,
|
||||
bool forward_output)
|
||||
static int do_os_system(char **argv, const char *input, size_t len, char **output, size_t *nread,
|
||||
bool silent, bool forward_output)
|
||||
{
|
||||
out_data_decide_throttle(0); // Initialize throttle decider.
|
||||
out_data_ring(NULL, 0); // Initialize output ring-buffer.
|
||||
@ -851,8 +840,7 @@ static void dynamic_buffer_ensure(DynamicBuffer *buf, size_t desired)
|
||||
buf->data = xrealloc(buf->data, buf->cap);
|
||||
}
|
||||
|
||||
static void system_data_cb(Stream *stream, RBuffer *buf, size_t count,
|
||||
void *data, bool eof)
|
||||
static void system_data_cb(Stream *stream, RBuffer *buf, size_t count, void *data, bool eof)
|
||||
{
|
||||
DynamicBuffer *dbuf = data;
|
||||
|
||||
@ -1015,8 +1003,7 @@ end:
|
||||
ui_flush();
|
||||
}
|
||||
|
||||
static void out_data_cb(Stream *stream, RBuffer *buf, size_t count, void *data,
|
||||
bool eof)
|
||||
static void out_data_cb(Stream *stream, RBuffer *buf, size_t count, void *data, bool eof)
|
||||
{
|
||||
size_t cnt;
|
||||
char *ptr = rbuffer_read_ptr(buf, &cnt);
|
||||
|
@ -3,25 +3,24 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <uv.h>
|
||||
#ifndef WIN32
|
||||
# include <signal.h> // for sigset_t
|
||||
#endif
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/memline.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"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/event/signal.h"
|
||||
#include "nvim/os/signal.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
static SignalWatcher spipe, shup, squit, sterm, susr1;
|
||||
#ifdef SIGPWR
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "nvim/os/stdpaths_defs.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/stdpaths_defs.h"
|
||||
#include "nvim/path.h"
|
||||
|
||||
/// Names of the environment variables, mapped to XDGVarType values
|
||||
static const char *xdg_env_vars[] = {
|
||||
@ -137,8 +137,7 @@ char *stdpaths_user_conf_subpath(const char *fname)
|
||||
/// @param[in] escape_commas If true, all commas will be escaped.
|
||||
///
|
||||
/// @return [allocated] `$XDG_DATA_HOME/nvim/{fname}`.
|
||||
char *stdpaths_user_data_subpath(const char *fname,
|
||||
const size_t trailing_pathseps,
|
||||
char *stdpaths_user_data_subpath(const char *fname, const size_t trailing_pathseps,
|
||||
const bool escape_commas)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
|
@ -3,15 +3,14 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/time.h"
|
||||
|
||||
static uv_mutex_t delay_mutex;
|
||||
static uv_cond_t delay_cond;
|
||||
@ -169,8 +168,7 @@ struct tm *os_localtime(struct tm *result) FUNC_ATTR_NONNULL_ALL
|
||||
/// @param result[out] Pointer to a 'char' where the result should be placed
|
||||
/// @param result_len length of result buffer
|
||||
/// @return human-readable string of current local time
|
||||
char *os_ctime_r(const time_t *restrict clock, char *restrict result,
|
||||
size_t result_len)
|
||||
char *os_ctime_r(const time_t *restrict clock, char *restrict result, size_t result_len)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
struct tm clock_local;
|
||||
|
@ -6,11 +6,10 @@
|
||||
#include <uv.h>
|
||||
|
||||
#include "auto/config.h"
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/strings.h"
|
||||
#ifdef HAVE_PWD_H
|
||||
# include <pwd.h>
|
||||
|
@ -5,11 +5,10 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unibilium.h>
|
||||
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/option.h"
|
||||
|
Reference in New Issue
Block a user