From 5e59916e84933b0b05fda8ed76cf5f24fa3f48b6 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 1 Jan 2016 14:37:20 +0300 Subject: eval: Use generated hash to look up function list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problems: - Disables cross-compiling (alternative: keeps two hash implementations which need to be synchronized with each other). - Puts code-specific name literals into CMakeLists.txt. - Workaround for lua’s absence of bidirectional pipe communication is rather ugly. --- src/nvim/lib/khash.h | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'src/nvim/lib') diff --git a/src/nvim/lib/khash.h b/src/nvim/lib/khash.h index 8287cb14da..f8530be79a 100644 --- a/src/nvim/lib/khash.h +++ b/src/nvim/lib/khash.h @@ -130,7 +130,9 @@ int main() { #include #include -#include "nvim/memory.h" +#ifndef USE_LIBC_ALLOCATOR +# include "nvim/memory.h" +#endif #include "nvim/func_attr.h" @@ -171,17 +173,32 @@ typedef khint_t khiter_t; #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) #endif -#ifndef kcalloc -#define kcalloc(N,Z) xcalloc(N,Z) -#endif -#ifndef kmalloc -#define kmalloc(Z) xmalloc(Z) -#endif -#ifndef krealloc -#define krealloc(P,Z) xrealloc(P,Z) -#endif -#ifndef kfree -#define kfree(P) xfree(P) +#ifdef USE_LIBC_ALLOCATOR +# ifndef kcalloc +# define kcalloc(N,Z) calloc(N,Z) +# endif +# ifndef kmalloc +# define kmalloc(Z) malloc(Z) +# endif +# ifndef krealloc +# define krealloc(P,Z) realloc(P,Z) +# endif +# ifndef kfree +# define kfree(P) free(P) +# endif +#else +# ifndef kcalloc +# define kcalloc(N,Z) xcalloc(N,Z) +# endif +# ifndef kmalloc +# define kmalloc(Z) xmalloc(Z) +# endif +# ifndef krealloc +# define krealloc(P,Z) xrealloc(P,Z) +# endif +# ifndef kfree +# define kfree(P) xfree(P) +# endif #endif #define __ac_HASH_UPPER 0.77 -- cgit