neovim/test/unit
bfredl 77e928fd3e refactor(fileio): remove API shell layer encouraging unnecessary allocations
Functions like file_open_new() and file_open_fd_new() which just is a
wrapper around the real functions but with an extra xmalloc/xfree around
is an anti-pattern. If the caller really needs to allocate a
FileDescriptor as a heap object, it can do that directly.

FileDescriptor by itself is pretty much a pointer, or rather two:
the OS fd index and a pointer to a buffer. So most of the time an extra
pointer layer is just wasteful.

In the case of scriptin[curscript] in getchar.c, curscript used
to mean in practice:

N+1 open scripts           when curscript>0
zero or one open scripts   when curscript==0

Which means scriptin[0] had to be compared to NULL to disambiguate the
curscript=0 case.

Instead, use curscript==-1 to mean that are no script,
then all pointer comparisons dissappear and we can just use an array of
structs without extra pointers.
2024-02-25 11:20:06 +01:00
..
api refactor(eval): use arena when converting typvals to Object 2024-02-15 10:42:06 +01:00
charset build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
eval test: do not inject vim module into global helpers 2024-01-12 12:04:18 +00:00
fixtures refactor: change event_create() to a macro (#26343) 2023-12-01 15:22:22 +08:00
os refactor(fileio): remove API shell layer encouraging unnecessary allocations 2024-02-25 11:20:06 +01:00
viml test: move format_{string,luav} to a separate module 2024-01-17 10:10:17 +00:00
buffer_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
fileio_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
formatc.lua docs: small fixes (#26243) 2023-12-06 08:04:21 +08:00
garray_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
helpers.lua test: refactor Paths 2024-01-17 10:10:17 +00:00
indent_spec.lua refactor(indent): refactor computing of a string's indent size (#27252) 2024-02-12 04:17:15 +08:00
keycodes_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
marktree_spec.lua fix(extmark): fix crash when stepping out from internal node 2024-01-23 11:39:37 +01:00
mbyte_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
memory_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
message_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
msgpack_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
multiqueue_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
optionstr_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
path_spec.lua test: use vim.mpack and vim.uv directly 2024-01-12 12:04:20 +00:00
preload.lua test: replace lfs with luv and vim.fs 2023-04-04 21:59:06 +02:00
preprocess.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
profile_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
rbuffer_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
search_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
set.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
statusline_spec.lua refactor(api): refactor more api functions to use arena return 2024-02-08 14:40:34 +01:00
strings_spec.lua build: enable lintlua for test/unit/ dir #26396 2023-12-04 14:32:39 -08:00
tempfile_spec.lua test: replace lfs with luv and vim.fs 2023-04-04 21:59:06 +02:00
testtest_spec.lua unittests: Collect traces 2017-04-01 12:25:10 +03:00
undo_spec.lua test: remove helpers.sleep() 2024-01-12 12:04:19 +00:00