From b888018aed249174aad7586859ac5142f1a3ef10 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 22 Aug 2021 10:41:18 +0200 Subject: refactor(marktree): embed the keymap in the MarkTree struct --- src/nvim/marktree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/nvim/marktree.c') diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index d0d843cbf8..a04f250fc3 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -250,7 +250,6 @@ void marktree_put_key(MarkTree *b, int row, int col, uint64_t id) if (!b->root) { b->root = (mtnode_t *)xcalloc(1, ILEN); - b->id2node = pmap_new(uint64_t)(); b->n_nodes++; } mtnode_t *r, *s; @@ -547,9 +546,9 @@ void marktree_clear(MarkTree *b) marktree_free_node(b->root); b->root = NULL; } - if (b->id2node) { - pmap_free(uint64_t)(b->id2node); - b->id2node = NULL; + if (b->id2node->table.keys) { + pmap_destroy(uint64_t)(b->id2node); + pmap_init(uint64_t, b->id2node); } b->n_keys = 0; b->n_nodes = 0; -- cgit