aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/map.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-08-25 23:00:29 +0200
committerbfredl <bjorn.linse@gmail.com>2023-09-10 13:09:44 +0200
commit87cde88c41d003988e7d5dbc4ddb26687d24923d (patch)
treefc48cd928eea258c9df8145d4007a5a667453b9c /src/nvim/map.c
parente99a3fd25daeb52f609c72cb7e96b83bd0610e9e (diff)
downloadrneovim-87cde88c41d003988e7d5dbc4ddb26687d24923d.tar.gz
rneovim-87cde88c41d003988e7d5dbc4ddb26687d24923d.tar.bz2
rneovim-87cde88c41d003988e7d5dbc4ddb26687d24923d.zip
refactor(memfile): change mf_trans and mf_hash from ad-hoc hashtable to Map
Memfile used a private implementation of an open hash table with intrusive collision chains, but there is no reason to assume the standard khash_t based Map won't work just fine. Yes, we are taking full ownership and maintenance over memline and memfile. No one is going to maintain it for us. Trust the plan.
Diffstat (limited to 'src/nvim/map.c')
-rw-r--r--src/nvim/map.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/map.c b/src/nvim/map.c
index e2c6443245..33a7759a1b 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -25,6 +25,8 @@
#define equal_uint32_t equal_simple
#define hash_int(x) hash_uint32_t((uint32_t)(x))
#define equal_int equal_simple
+#define hash_int64_t(key) hash_uint64_t((uint64_t)key)
+#define equal_int64_t equal_simple
#if defined(ARCH_64)
# define hash_ptr_t(key) hash_uint64_t((uint64_t)(key))
@@ -182,6 +184,16 @@ void mh_clear(MapHash *h)
#undef VAL_NAME
#undef KEY_NAME
+#define KEY_NAME(x) x##int64_t
+#include "nvim/map_key_impl.c.h"
+#define VAL_NAME(x) quasiquote(x, ptr_t)
+#include "nvim/map_value_impl.c.h"
+#undef VAL_NAME
+#define VAL_NAME(x) quasiquote(x, int64_t)
+#include "nvim/map_value_impl.c.h"
+#undef VAL_NAME
+#undef KEY_NAME
+
#define KEY_NAME(x) x##HlEntry
#include "nvim/map_key_impl.c.h"
#define VAL_NAME(x) quasiquote(x, int)