mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Use uintptr_t
as the hashtable type in helpers.c
This commit is contained in:
parent
32b6122460
commit
b7108002bb
@ -14,14 +14,15 @@
|
|||||||
|
|
||||||
#include "nvim/lib/khash.h"
|
#include "nvim/lib/khash.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(ARCH_64)
|
#if defined(ARCH_64)
|
||||||
typedef uint64_t ptr_int_t;
|
#define ptr_hash_func(key) kh_int64_hash_func(key)
|
||||||
KHASH_SET_INIT_INT64(Lookup)
|
|
||||||
#elif defined(ARCH_32)
|
#elif defined(ARCH_32)
|
||||||
typedef uint32_t ptr_int_t;
|
#define ptr_hash_func(key) kh_int_hash_func(key)
|
||||||
KHASH_SET_INIT_INT(Lookup)
|
|
||||||
#endif
|
#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
|
/// Recursion helper for the `vim_to_object`. This uses a pointer table
|
||||||
/// to avoid infinite recursion due to cyclic references
|
/// 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) {
|
if (obj->v_type == VAR_LIST || obj->v_type == VAR_DICT) {
|
||||||
int ret;
|
int ret;
|
||||||
// Container object, add it to the lookup table
|
// 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) {
|
if (!ret) {
|
||||||
// It's already present, meaning we alredy processed it so just return
|
// It's already present, meaning we alredy processed it so just return
|
||||||
// nil instead.
|
// nil instead.
|
||||||
|
Loading…
Reference in New Issue
Block a user