aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/rbuffer.c
Commit message (Collapse)AuthorAge
* refactor(io): make rstream use a linear bufferbfredl2024-06-08
| | | | | | | | | If you like it you shouldn't put a ring on it. This is what _every_ consumer of RStream used anyway, either by calling rbuffer_reset, or rbuffer_consumed_compact (same as rbuffer_reset without needing a scratch buffer), or by consuming everything in each stream_read_cb call directly.
* refactor(fileio): use a linear buffer for FileDescriptorbfredl2024-05-30
| | | | | | | | | | | | | | | | Using a ring buffer for buffered synchronous fileio is just unnecessary complexity. - when reading, we always consume the _entire_ buffer before getting into syscalls. Thus we reset the buffer to its initial position before when we actually read. - when writing and buffer is full, we always flush the entire buffer before starting to buffer again. So we can reset the buffer to its initial state. Also no static buffers are needed for writing and skipping. Needing an extra copy for each write completely defeated the purpose of a ring buffer (if there had been one)
* refactor(shada): remove ShaDaReadDef secondary wrapperbfredl2024-05-28
| | | | | | `FileDescriptor` is already a wrapper around an fd and a buffer. By allowing to just use the buffer without an fd, it can already handle in-memory reads.
* fix(rpc): do not crash when no input is consumedbfredl2024-03-21
| | | | | | fixes #23781 Co-authored-by: glacambre <code@lacamb.re>
* refactor: follow style guidedundargoc2023-12-30
|
* refactor(IWYU): create {ex_getln,rbuffer,os/fileio}_defs.h (#26338)zeertzjq2023-12-01
|
* build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq2023-11-30
| | | | | | FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header.
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* fix(rbuffer): handle edge case where write_ptr has wrapped aroundbfredl2023-01-14
| | | | | | | | | | when using the rbuffer as a linear buffer, exactly filling the buffer will case write_ptr to wrap around too early. For now detect this special case. Of course, the rbuffer should refactored to a proper ring buffer where write_pos >= read_pos always and there is no special case for full buffers. This will be a follow up change.
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* docs: fix typos (#19588)dundargoc2022-08-03
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: notomo <notomo.motono@gmail.com>
* refactor(api): use a unpacker based on libmpack instead of msgpack-cbfredl2022-06-02
| | | | | | | | | | Currently this is more or less a straight off reimplementation, but this allow further optimizations down the line, especially for avoiding memory allocations of rpc objects. Current score for "make functionaltest; make oldtest" on a -DEXITFREE build: is 117 055 352 xfree(ptr != NULL) calls (that's NUMBERWANG!).
* refactor(uncrustify): change rules to better align with the style guideDundar Goc2022-04-29
| | | | | | | | | | | | | Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
* refactor: format with uncrustify #15755dundargoc2021-09-24
|
* channels: allow bytes sockets and stdio, and buffered bytes outputBjörn Linse2017-11-24
|
* *: Add comment to all C filesZyX2017-04-19
|
* rbuffer: Use xcalloc to ensure memory is initializedJames McCoy2016-11-28
| | | | | | | | | Since the rbuffer contents are used by string functions (like sscan, strlen, etc.), it is not safe to use uninitialized memory. Using xcalloc ensures the string-based functions do not run past the end of the buffer. Closes #5676
* Merge #4646 from oni-link/fix.issue.4569.3Justin M. Keyes2016-06-26
|\ | | | | Fix for missing output (#4569, ...)
| * process.c: Prevent data loss for process output streamsoni-link2016-05-15
| | | | | | | | | | For a terminating process, it's output streams could be closed, before all data is read.
* | file: Add buffered reading and writingZyX2016-06-23
|/ | | | Still no busted tests. Not tested without HAVE_PREADV.
* rbuffer: Enhance rbuffer_reset to work with filled RBuffersThiago de Arruda2015-10-01
|
* rbuffer: Fix for problems with escape input sequences.oni-link2015-07-07
| | | | | | | | | | | If at least two escape sequences were read, the beginning of the second sequence would be off by one and the sequence would be misinterpreted. An escape sequence could be split in two parts and be misinterpreted, when saved in a ring buffer with wrap around. Fixes #2936
* rbuffer: Reimplement as a ring buffer and decouple from rstreamThiago de Arruda2015-07-01
Extract the RBuffer class from rstream.c and reimplement it as a ring buffer, a more efficient version that doesn't need to relocate memory. The old rbuffer_read/rbuffer_write interfaces are kept for simple reading/writing, and the RBUFFER_UNTIL_{FULL,EMPTY} macros are introduced to hide wrapping logic when more control is required(such as passing the buffer pointer to a library function that writes directly to the pointer) Also add a basic infrastructure for writing helper C files that are only compiled in the unit test library, and use this to write unit tests for RBuffer which contains some macros that can't be accessed directly by luajit. Helped-by: oni-link <knil.ino@gmail.com> Reviewed-by: oni-link <knil.ino@gmail.com> Reviewed-by: Scott Prager <splinterofchaos@gmail.com> Reviewed-by: Justin M. Keyes <justinkz@gmail.com> Reviewed-by: Michael Reed <m.reed@mykolab.com>