diff options
Diffstat (limited to 'src')
40 files changed, 37 insertions, 78 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index a8446265d0..b7a86af134 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -1,6 +1,5 @@ // Much of this code was adapted from 'if_py_both.h' from the original // vim source -#include <errno.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index e0aac141ac..fb1aeb7ba8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -25,7 +25,6 @@ */ #include <stdbool.h> -#include <errno.h> #include <string.h> #include <inttypes.h> diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 6e2b3056e4..d311588ab4 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -2,7 +2,6 @@ /// /// Code for diff'ing two, three or four buffers. -#include <errno.h> #include <inttypes.h> #include <stdbool.h> diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 01b9981192..08b587df8a 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <string.h> #include <inttypes.h> #include <stdbool.h> diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a97f6ac570..cec7c91c03 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12,7 +12,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdarg.h> #include <string.h> diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 347e464d25..93cc592683 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -97,7 +97,7 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb) result = uv_listen(watcher->stream, backlog, connection_cb); } - assert(result <= 0); // libuv should have returned -errno or zero. + assert(result <= 0); // libuv should return negative error code or zero. if (result < 0) { if (result == -EACCES) { // Libuv converts ENOENT to EACCES for Windows compatibility, but if diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 376eb9fce7..71582ab357 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -13,7 +13,7 @@ /// Sets the stream associated with `fd` to "blocking" mode. /// -/// @return `0` on success, or `-errno` on failure. +/// @return `0` on success, or libuv error code on failure. int stream_set_blocking(int fd, bool blocking) { // Private loop to avoid conflict with existing watcher(s): diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b232d3fe81..f69910eb99 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index e2e3368d0f..bb629fad76 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 720d97a883..b50c7330d3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -14,7 +14,6 @@ #include <string.h> #include <stdbool.h> #include <stdint.h> -#include <errno.h> #include <inttypes.h> #include "nvim/vim.h" diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index be98da7cfc..c9a324b49f 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index fbff7d2417..4f345158cf 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -45,7 +45,6 @@ */ #include <assert.h> -#include <errno.h> #include <string.h> #include <stdbool.h> #include <stdint.h> diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c07597df47..4aa4d4c399 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -535,11 +535,7 @@ readfile ( if (!newfile) { return FAIL; } - if (perm < 0 -#ifdef ENOENT - && errno == ENOENT -#endif - ) { + if (perm == UV_ENOENT) { /* * Set the 'new-file' flag, so that when the file has * been created by someone else, a ":w" will complain. @@ -582,11 +578,11 @@ readfile ( return OK; /* a new file is not an error */ } else { filemess(curbuf, sfname, (char_u *)( -# ifdef EFBIG - (errno == EFBIG) ? _("[File too big]") : -# endif -# ifdef EOVERFLOW - (errno == EOVERFLOW) ? _("[File too big]") : + (fd == UV_EFBIG) ? _("[File too big]") : +# if defined(UNIX) && defined(EOVERFLOW) + // libuv only returns -errno in Unix and in Windows open() does not + // set EOVERFLOW + (fd == -EOVERFLOW) ? _("[File too big]") : # endif _("[Permission Denied]")), 0); curbuf->b_p_ro = TRUE; /* must use "w!" now */ diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 73febdd0e6..9f7431ee7d 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <string.h> #include <inttypes.h> #include <stdint.h> diff --git a/src/nvim/main.c b/src/nvim/main.c index f49db5cd82..203aeb8d69 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -8,7 +8,6 @@ #define EXTERN #include <assert.h> -#include <errno.h> #include <stdint.h> #include <string.h> #include <stdbool.h> diff --git a/src/nvim/mark.c b/src/nvim/mark.c index ae394b4da6..38a76a45e6 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <string.h> #include <limits.h> diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index cdf8eba5d3..fc7199e3a6 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -71,7 +71,6 @@ * some commands, like ":menutrans" */ -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 6e94d7392a..b2783736e1 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -44,7 +44,6 @@ /// mf_fullname() make file name full path (use before first :cd) #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <limits.h> #include <string.h> diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 6d386f3599..8db47b79c1 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -1,7 +1,6 @@ // Various routines dealing with allocation and deallocation of memory. #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <string.h> #include <stdbool.h> diff --git a/src/nvim/message.c b/src/nvim/message.c index 341306c6ca..52e2a286c3 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <stdarg.h> diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 3cdb8f59c7..0ba6929686 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c index 11cdd81b35..d72a8f17e0 100644 --- a/src/nvim/misc2.c +++ b/src/nvim/misc2.c @@ -10,7 +10,6 @@ * misc2.c: Various functions. */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <string.h> diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 6713ab7591..a0d2c7903d 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -12,7 +12,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <string.h> #include <stdbool.h> diff --git a/src/nvim/option.c b/src/nvim/option.c index bb14cae627..8b4aab88a3 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -30,7 +30,6 @@ #define IN_OPTION_C #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 633eabab60..b22e994efe 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -51,15 +51,6 @@ return { defaults={if_true={vi=224}} }, { - full_name='antialias', abbreviation='anti', - type='bool', scope={'global'}, - vi_def=true, - vim=true, - redraw={'everything'}, - enable_if=false, - defaults={if_true={vi=false, vim=false}} - }, - { full_name='arabic', abbreviation='arab', type='bool', scope={'window'}, vi_def=true, diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 3fb00eb24e..d59b66e773 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -185,13 +185,13 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath) /// Opens or creates a file and returns a non-negative integer representing /// the lowest-numbered unused file descriptor, for use in subsequent system -/// calls (read, write, lseek, fcntl, etc.). If the operation fails, `-errno` -/// is returned, and no file is created or modified. +/// calls (read, write, lseek, fcntl, etc.). If the operation fails, a libuv +/// error code is returned, and no file is created or modified. /// /// @param flags Bitwise OR of flags defined in <fcntl.h> /// @param mode Permissions for the newly-created file (IGNORED if 'flags' is /// not `O_CREAT` or `O_TMPFILE`), subject to the current umask -/// @return file descriptor, or negative `errno` on failure +/// @return file descriptor, or libuv error code on failure int os_open(const char* path, int flags, int mode) FUNC_ATTR_NONNULL_ALL { @@ -204,28 +204,29 @@ int os_open(const char* path, int flags, int mode) /// Get stat information for a file. /// -/// @return OK on success, FAIL if a failure occurred. -static bool os_stat(const char *name, uv_stat_t *statbuf) +/// @return libuv return code. +static int os_stat(const char *name, uv_stat_t *statbuf) FUNC_ATTR_NONNULL_ALL { uv_fs_t request; int result = uv_fs_stat(&fs_loop, &request, name, NULL); *statbuf = request.statbuf; uv_fs_req_cleanup(&request); - return (result == kLibuvSuccess); + return result; } /// Get the file permissions for a given file. /// -/// @return `-1` when `name` doesn't exist. +/// @return libuv error code on error. int32_t os_getperm(const char_u *name) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - if (os_stat((char *)name, &statbuf)) { + int stat_result = os_stat((char *)name, &statbuf); + if (stat_result == kLibuvSuccess) { return (int32_t)statbuf.st_mode; } else { - return -1; + return stat_result; } } @@ -270,7 +271,7 @@ bool os_file_exists(const char_u *name) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - return os_stat((char *)name, &statbuf); + return os_stat((char *)name, &statbuf) == kLibuvSuccess; } /// Check if a file is readable. @@ -322,7 +323,7 @@ int os_rename(const char_u *path, const char_u *new_path) /// Make a directory. /// -/// @return `0` for success, -errno for failure. +/// @return `0` for success, libuv error code for failure. int os_mkdir(const char *path, int32_t mode) FUNC_ATTR_NONNULL_ALL { @@ -342,7 +343,7 @@ int os_mkdir(const char *path, int32_t mode) /// failed to create. I.e. it will contain dir or any /// of the higher level directories. /// -/// @return `0` for success, -errno for failure. +/// @return `0` for success, libuv error code for failure. int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_dir) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT @@ -470,7 +471,7 @@ int os_remove(const char *path) bool os_fileinfo(const char *path, FileInfo *file_info) FUNC_ATTR_NONNULL_ALL { - return os_stat(path, &(file_info->stat)); + return os_stat(path, &(file_info->stat)) == kLibuvSuccess; } /// Get the file information for a given path without following links @@ -572,7 +573,7 @@ bool os_fileid(const char *path, FileID *file_id) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - if (os_stat(path, &statbuf)) { + if (os_stat(path, &statbuf) == kLibuvSuccess) { file_id->inode = statbuf.st_ino; file_id->device_id = statbuf.st_dev; return true; diff --git a/src/nvim/os/fs_defs.h b/src/nvim/os/fs_defs.h index df1031b721..52b2841514 100644 --- a/src/nvim/os/fs_defs.h +++ b/src/nvim/os/fs_defs.h @@ -21,9 +21,9 @@ typedef struct { uv_dirent_t ent; ///< @private The entry information. } Directory; -/// Function to convert -errno error to char * error description +/// Function to convert libuv error to char * error description /// -/// -errno errors are returned by a number of os functions. +/// negative libuv error codes are returned by a number of os functions. #define os_strerror uv_strerror #endif // NVIM_OS_FS_DEFS_H diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h index 3d56115401..55a2d5513e 100644 --- a/src/nvim/os/os_defs.h +++ b/src/nvim/os/os_defs.h @@ -103,9 +103,9 @@ # include <strings.h> #endif -/// Function to convert -errno error to char * error description +/// Function to convert libuv error to char * error description /// -/// -errno errors are returned by a number of os functions. +/// negative libuv error codes are returned by a number of os functions. #define os_strerror uv_strerror #endif // NVIM_OS_OS_DEFS_H diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index d614582250..bfd431c9c6 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -28,7 +28,9 @@ # endif #endif +#ifdef _MSC_VER typedef SSIZE_T ssize_t; +#endif #ifndef SSIZE_MAX # ifdef _WIN64 diff --git a/src/nvim/path.c b/src/nvim/path.c index eaca85ed40..a14ba38508 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1,6 +1,5 @@ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <stdlib.h> diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f3818ef639..8be010c560 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 3c2c18ed32..bea09fd804 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -87,7 +87,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/search.c b/src/nvim/search.c index 0e748dec6d..89c96fe31e 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -10,7 +10,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 939c435c01..231dad07e5 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -815,7 +815,7 @@ static ShaDaReadResult sd_reader_skip(ShaDaReadDef *const sd_reader, /// /// All arguments are passed to os_open(). /// -/// @return file descriptor or -errno on failure. +/// @return file descriptor or libuv error on failure. static int open_file(const char *const fname, const int flags, const int mode) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { @@ -825,15 +825,15 @@ open_file_start: fd = os_open(fname, flags, mode); if (fd < 0) { - if (-fd == ENOENT) { + if (fd == UV_ENOENT) { return fd; } - if (-fd == ENOMEM && !did_try_to_free) { + if (fd == UV_ENOMEM && !did_try_to_free) { try_to_free_memory(); did_try_to_free = true; goto open_file_start; } - if (-fd != EEXIST) { + if (fd != UV_EEXIST) { emsg3(_(SERR "System error while opening ShaDa file %s: %s"), fname, os_strerror(fd)); } @@ -847,7 +847,7 @@ open_file_start: /// @param[in] fname File name to open. /// @param[out] sd_reader Location where reader structure will be saved. /// -/// @return -errno in case of error, 0 otherwise. +/// @return libuv error in case of error, 0 otherwise. static int open_shada_file_for_reading(const char *const fname, ShaDaReadDef *sd_reader) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL @@ -965,7 +965,7 @@ static int shada_read_file(const char *const file, const int flags) } if (of_ret != 0) { - if (-of_ret == ENOENT && (flags & kShaDaMissingError)) { + if (of_ret == UV_ENOENT && (flags & kShaDaMissingError)) { emsg3(_(SERR "System error while opening ShaDa file %s for reading: %s"), fname, os_strerror(of_ret)); } @@ -2964,9 +2964,9 @@ shada_write_file_open: fd = (intptr_t) open_file(tempname, O_CREAT|O_WRONLY|O_NOFOLLOW|O_EXCL, perm); if (fd < 0) { - if (-fd == EEXIST + if (fd == UV_EEXIST #ifdef ELOOP - || -fd == ELOOP + || fd == UV_ELOOP #endif ) { // File already exists, try another name diff --git a/src/nvim/spell.c b/src/nvim/spell.c index c228a450d6..a5b66ad220 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -285,7 +285,6 @@ // few bytes as possible, see offset2bytes()) #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <limits.h> #include <stdbool.h> diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 9ffa5c6a76..4bd394cb44 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -1,5 +1,4 @@ -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 099bf1ca29..f65b21a40b 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -12,7 +12,6 @@ #include <assert.h> #include <ctype.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 96b6dbe51f..1b3fda8aca 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -11,7 +11,6 @@ */ #include <assert.h> -#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/undo.c b/src/nvim/undo.c index fe6070994f..6c87f01746 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -83,7 +83,6 @@ #include <assert.h> #include <inttypes.h> #include <limits.h> -#include <errno.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/window.c b/src/nvim/window.c index 206cefd484..8ac50b2731 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6,7 +6,6 @@ * See README.md for an overview of the Vim source code. */ -#include <errno.h> #include <assert.h> #include <inttypes.h> #include <stdbool.h> |