mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
refactor(map): avoid duplicated khash_t types for values
This reduces the total number of khash_t instantiations from 22 to 8. Make the khash internal functions take the size of values as a runtime parameter. This is abstracted with typesafe Map containers which are still specialized for both key, value type. Introduce `Set(key)` type for when there is no value. Refactor shada.c to use Map/Set instead of khash directly. This requires `map_ref` operation to be more flexible. Return pointers to both key and value, plus an indicator for new_item. As a bonus, `map_key` is now redundant. Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is humongous. Make `event_strings` actually work like an intern pool instead of wtf it was doing before.
This commit is contained in:
@@ -833,7 +833,7 @@ void buf_freeall(buf_T *buf, int flags)
|
||||
/// itself (not the file, that must have been done already).
|
||||
static void free_buffer(buf_T *buf)
|
||||
{
|
||||
pmap_del(handle_T)(&buffer_handles, buf->b_fnum);
|
||||
pmap_del(int)(&buffer_handles, buf->b_fnum, NULL);
|
||||
buf_free_count++;
|
||||
// b:changedtick uses an item in buf_T.
|
||||
free_buffer_stuff(buf, kBffClearWinInfo);
|
||||
@@ -1865,7 +1865,7 @@ buf_T *buflist_new(char *ffname_arg, char *sfname_arg, linenr_T lnum, int flags)
|
||||
lastbuf = buf;
|
||||
|
||||
buf->b_fnum = top_file_num++;
|
||||
pmap_put(handle_T)(&buffer_handles, buf->b_fnum, buf);
|
||||
pmap_put(int)(&buffer_handles, buf->b_fnum, buf);
|
||||
if (top_file_num < 0) { // wrap around (may cause duplicates)
|
||||
emsg(_("W14: Warning: List of file names overflow"));
|
||||
if (emsg_silent == 0 && !in_assert_fails) {
|
||||
|
Reference in New Issue
Block a user