mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
77e928fd3e
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. |
||
---|---|---|
.. | ||
api | ||
charset | ||
eval | ||
fixtures | ||
os | ||
viml | ||
buffer_spec.lua | ||
fileio_spec.lua | ||
formatc.lua | ||
garray_spec.lua | ||
helpers.lua | ||
indent_spec.lua | ||
keycodes_spec.lua | ||
marktree_spec.lua | ||
mbyte_spec.lua | ||
memory_spec.lua | ||
message_spec.lua | ||
msgpack_spec.lua | ||
multiqueue_spec.lua | ||
optionstr_spec.lua | ||
path_spec.lua | ||
preload.lua | ||
preprocess.lua | ||
profile_spec.lua | ||
rbuffer_spec.lua | ||
search_spec.lua | ||
set.lua | ||
statusline_spec.lua | ||
strings_spec.lua | ||
tempfile_spec.lua | ||
testtest_spec.lua | ||
undo_spec.lua |