aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/map.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-05-19 10:52:15 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-19 10:52:15 -0300
commit25595d97d5c1038dd3789e85194a81ee7e4fdbd2 (patch)
treecb702efff9dc967bb4d946fbe8e0b46d16d524ad /src/nvim/map.c
parent37dfe2d48f16e4227dd713ebeb03257490f78e67 (diff)
downloadrneovim-25595d97d5c1038dd3789e85194a81ee7e4fdbd2.tar.gz
rneovim-25595d97d5c1038dd3789e85194a81ee7e4fdbd2.tar.bz2
rneovim-25595d97d5c1038dd3789e85194a81ee7e4fdbd2.zip
Improve map module: Refactor vim_to_object_rec
Now the map.c module is used to implement the 'lookup set' for that function
Diffstat (limited to 'src/nvim/map.c')
-rw-r--r--src/nvim/map.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/map.c b/src/nvim/map.c
index d8260c9a7d..28fd0af61c 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -15,6 +15,15 @@
#define uint32_t_hash kh_int_hash_func
#define uint32_t_eq kh_int_hash_equal
+#if defined(ARCH_64)
+#define ptr_t_hash(key) uint64_t_hash((uint64_t)key)
+#define ptr_t_eq(a, b) uint64_t_eq((uint64_t)a, (uint64_t)b)
+#elif defined(ARCH_32)
+#define ptr_t_hash(key) uint32_t_hash((uint32_t)key)
+#define ptr_t_eq(a, b) uint32_t_eq((uint32_t)a, (uint32_t)b)
+#endif
+
+
#define MAP_IMPL(T) \
__KHASH_IMPL(T##_map,, T, void *, 1, T##_hash, T##_eq) \
\
@@ -27,7 +36,6 @@
\
void map_##T##_free(Map(T) *map) \
{ \
- kh_clear(T##_map, map->table); \
kh_destroy(T##_map, map->table); \
free(map); \
} \
@@ -56,11 +64,9 @@
\
if (!ret) { \
rv = kh_val(map->table, k); \
- kh_del(T##_map, map->table, k); \
} \
\
kh_val(map->table, k) = value; \
- \
return rv; \
} \
\
@@ -78,3 +84,4 @@
}
MAP_IMPL(cstr_t)
+MAP_IMPL(ptr_t)