diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-16 08:04:46 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-17 08:05:44 -0300 |
commit | b7108002bb7ac910bf9c88596d1075ce9bc9f0a7 (patch) | |
tree | 20c933417bb8bd5524d2a93c72ba5e9d469abfc0 /src | |
parent | 32b612246015501c8e62c45f918542d4188792ce (diff) | |
download | rneovim-b7108002bb7ac910bf9c88596d1075ce9bc9f0a7.tar.gz rneovim-b7108002bb7ac910bf9c88596d1075ce9bc9f0a7.tar.bz2 rneovim-b7108002bb7ac910bf9c88596d1075ce9bc9f0a7.zip |
Use `uintptr_t` as the hashtable type in helpers.c
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/helpers.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/api/helpers.c b/src/nvim/api/helpers.c index aa76a5dc24..2f79bebeef 100644 --- a/src/nvim/api/helpers.c +++ b/src/nvim/api/helpers.c @@ -14,14 +14,15 @@ #include "nvim/lib/khash.h" + #if defined(ARCH_64) -typedef uint64_t ptr_int_t; -KHASH_SET_INIT_INT64(Lookup) +#define ptr_hash_func(key) kh_int64_hash_func(key) #elif defined(ARCH_32) -typedef uint32_t ptr_int_t; -KHASH_SET_INIT_INT(Lookup) +#define ptr_hash_func(key) kh_int_hash_func(key) #endif +KHASH_INIT(Lookup, uintptr_t, char, 0, ptr_hash_func, kh_int_hash_equal) + /// Recursion helper for the `vim_to_object`. This uses a pointer table /// to avoid infinite recursion due to cyclic references /// @@ -412,7 +413,7 @@ static Object vim_to_object_rec(typval_T *obj, khash_t(Lookup) *lookup) if (obj->v_type == VAR_LIST || obj->v_type == VAR_DICT) { int ret; // Container object, add it to the lookup table - kh_put(Lookup, lookup, (ptr_int_t)obj, &ret); + kh_put(Lookup, lookup, (uintptr_t)obj, &ret); if (!ret) { // It's already present, meaning we alredy processed it so just return // nil instead. |