diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-05-14 18:45:56 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-05-17 12:26:21 +0200 |
commit | e2fdd53d8c015913e8be4ff708fc3488558c8906 (patch) | |
tree | 2858a7eb734b605225296c0019aa8048e24e425d /src/nvim/marktree.c | |
parent | 33687f5e87a0f048f7bc02d4658e58ef8cc0fd49 (diff) | |
download | rneovim-e2fdd53d8c015913e8be4ff708fc3488558c8906.tar.gz rneovim-e2fdd53d8c015913e8be4ff708fc3488558c8906.tar.bz2 rneovim-e2fdd53d8c015913e8be4ff708fc3488558c8906.zip |
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.
Diffstat (limited to 'src/nvim/marktree.c')
-rw-r--r-- | src/nvim/marktree.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index 757906d42f..840b6b646e 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -359,7 +359,7 @@ uint64_t marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) } b->n_keys--; - pmap_del(uint64_t)(b->id2node, id); + pmap_del(uint64_t)(b->id2node, id, NULL); // 5. bool itr_dirty = false; @@ -549,8 +549,8 @@ void marktree_clear(MarkTree *b) b->root = NULL; } if (b->id2node->table.keys) { - pmap_destroy(uint64_t)(b->id2node); - pmap_init(uint64_t, b->id2node); + map_destroy(uint64_t, b->id2node); + *b->id2node = (PMap(uint64_t)) MAP_INIT; } b->n_keys = 0; b->n_nodes = 0; |