mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +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:
@@ -122,13 +122,13 @@
|
||||
#define api_free_window(value)
|
||||
#define api_free_tabpage(value)
|
||||
|
||||
EXTERN PMap(handle_T) buffer_handles INIT(= MAP_INIT);
|
||||
EXTERN PMap(handle_T) window_handles INIT(= MAP_INIT);
|
||||
EXTERN PMap(handle_T) tabpage_handles INIT(= MAP_INIT);
|
||||
EXTERN PMap(int) buffer_handles INIT(= MAP_INIT);
|
||||
EXTERN PMap(int) window_handles INIT(= MAP_INIT);
|
||||
EXTERN PMap(int) tabpage_handles INIT(= MAP_INIT);
|
||||
|
||||
#define handle_get_buffer(h) pmap_get(handle_T)(&buffer_handles, (h))
|
||||
#define handle_get_window(h) pmap_get(handle_T)(&window_handles, (h))
|
||||
#define handle_get_tabpage(h) pmap_get(handle_T)(&tabpage_handles, (h))
|
||||
#define handle_get_buffer(h) pmap_get(int)(&buffer_handles, (h))
|
||||
#define handle_get_window(h) pmap_get(int)(&window_handles, (h))
|
||||
#define handle_get_tabpage(h) pmap_get(int)(&tabpage_handles, (h))
|
||||
|
||||
/// Structure used for saving state for :try
|
||||
///
|
||||
|
Reference in New Issue
Block a user