From 4be6c6cf0ddf5e31d4103cb5df06651ba6f4897b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 11:05:57 +0100 Subject: refactor: replace char_u with char (#21901) refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/fileio.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index dabcda5bf2..3e51e361ac 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -18,8 +18,6 @@ #define READ_NOWINENTER 0x80 // do not trigger BufWinEnter #define READ_NOFILE 0x100 // do not read a file, do trigger BufReadCmd -#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y)) - typedef varnumber_T (*CheckItem)(void *expr, const char *name); #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit From 7bf1a917b78ebc622b6691af9196b95b4a9d3142 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 19 Apr 2023 13:15:29 +0100 Subject: vim-patch:8.1.2094: the fileio.c file is too big Problem: The fileio.c file is too big. Solution: Move buf_write() to bufwrite.c. (Yegappan Lakshmanan, closes vim/vim#4990) https://github.com/vim/vim/commit/c079f0fed1c16495d726d616c5362edc04742a0d Co-authored-by: Yegappan Lakshmanan Co-authored-by: zeertzjq --- src/nvim/fileio.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 3e51e361ac..a4566d754b 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -20,8 +20,29 @@ typedef varnumber_T (*CheckItem)(void *expr, const char *name); +enum { + FIO_LATIN1 = 0x01, // convert Latin1 + FIO_UTF8 = 0x02, // convert UTF-8 + FIO_UCS2 = 0x04, // convert UCS-2 + FIO_UCS4 = 0x08, // convert UCS-4 + FIO_UTF16 = 0x10, // convert UTF-16 + FIO_ENDIAN_L = 0x80, // little endian + FIO_NOCONVERT = 0x2000, // skip encoding conversion + FIO_UCSBOM = 0x4000, // check for BOM at start of file + FIO_ALL = -1, // allow all formats +}; + +// When converting, a read() or write() may leave some bytes to be converted +// for the next call. The value is guessed... +#define CONV_RESTLEN 30 + +#define WRITEBUFSIZE 8192 // size of normal write buffer + +// We have to guess how much a sequence of bytes may expand when converting +// with iconv() to be able to allocate a buffer. +#define ICONV_MULT 8 + #ifdef INCLUDE_GENERATED_DECLARATIONS -// Events for autocommands # include "fileio.h.generated.h" #endif #endif // NVIM_FILEIO_H -- cgit From 6a273af10517d1f7e4ea85635f1d25a9158adeb5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 10:40:53 +0800 Subject: refactor: remove typval.h from most header files (#23601) Because typval_defs.h is enough for most of them. --- src/nvim/fileio.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index a4566d754b..5eb2689233 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -2,7 +2,6 @@ #define NVIM_FILEIO_H #include "nvim/buffer_defs.h" -#include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/garray.h" #include "nvim/os/os.h" -- cgit From 09a17f91d0d362c6e58bfdbe3ccdeacffb0b44b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Oct 2023 10:45:33 +0800 Subject: refactor: move cmdline completion types to cmdexpand_defs.h (#25465) --- src/nvim/fileio.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 5eb2689233..92ea866239 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -3,7 +3,10 @@ #include "nvim/buffer_defs.h" #include "nvim/eval/typval_defs.h" +#include "nvim/ex_cmds_defs.h" #include "nvim/garray.h" +#include "nvim/globals.h" +#include "nvim/os/fs_defs.h" #include "nvim/os/os.h" // Values for readfile() flags -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/fileio.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 92ea866239..85d41e466a 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -1,5 +1,4 @@ -#ifndef NVIM_FILEIO_H -#define NVIM_FILEIO_H +#pragma once #include "nvim/buffer_defs.h" #include "nvim/eval/typval_defs.h" @@ -47,4 +46,3 @@ enum { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "fileio.h.generated.h" #endif -#endif // NVIM_FILEIO_H -- cgit From 6361806aa28edca55ad3316a58bc3e936df9c0eb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Nov 2023 22:58:52 +0800 Subject: refactor: move garray_T to garray_defs.h (#26227) --- src/nvim/fileio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 85d41e466a..318be20c91 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -3,7 +3,7 @@ #include "nvim/buffer_defs.h" #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" -#include "nvim/garray.h" +#include "nvim/garray_defs.h" #include "nvim/globals.h" #include "nvim/os/fs_defs.h" #include "nvim/os/os.h" -- cgit From 38a20dd89f91c45ec8589bf1c50d50732882d38a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 20:58:37 +0800 Subject: build(IWYU): replace most private mappings with pragmas (#26247) --- src/nvim/fileio.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 318be20c91..d3a0e8c54a 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -1,12 +1,16 @@ #pragma once -#include "nvim/buffer_defs.h" +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep + +#include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" -#include "nvim/ex_cmds_defs.h" -#include "nvim/garray_defs.h" +#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep +#include "nvim/garray_defs.h" // IWYU pragma: keep #include "nvim/globals.h" -#include "nvim/os/fs_defs.h" -#include "nvim/os/os.h" +#include "nvim/os/fs_defs.h" // IWYU pragma: keep +#include "nvim/pos.h" // Values for readfile() flags #define READ_NEW 0x01 // read a file into a new buffer -- cgit From f4aedbae4cb1f206f5b7c6142697b71dd473059b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:39:38 +0100 Subject: build(IWYU): fix includes for undo_defs.h --- src/nvim/fileio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/fileio.h') diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index d3a0e8c54a..d1f6561507 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -10,7 +10,7 @@ #include "nvim/garray_defs.h" // IWYU pragma: keep #include "nvim/globals.h" #include "nvim/os/fs_defs.h" // IWYU pragma: keep -#include "nvim/pos.h" +#include "nvim/pos_defs.h" // Values for readfile() flags #define READ_NEW 0x01 // read a file into a new buffer -- cgit