Use platform check for correct selection of khash type in helpers.c

This commit is contained in:
Thiago de Arruda
2014-05-12 21:44:33 -03:00
parent f69b0a1dc7
commit f0f4ab5500
3 changed files with 14 additions and 1 deletions

View File

@@ -14,7 +14,13 @@
#include "lib/khash.h"
#if defined(ARCH_64)
typedef uint64_t ptr_int_t;
KHASH_SET_INIT_INT64(Lookup)
#elif defined(ARCH_32)
typedef uint32_t ptr_int_t;
KHASH_SET_INIT_INT(Lookup)
#endif
/// Recursion helper for the `vim_to_object`. This uses a pointer table
/// to avoid infinite recursion due to cyclic references
@@ -406,7 +412,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, (uint64_t)obj, &ret);
kh_put(Lookup, lookup, (ptr_int_t)obj, &ret);
if (!ret) {
// It's already present, meaning we alredy processed it so just return
// nil instead.