From 49ef9d50d475921aab0c50b13b857f8cb990fcc0 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 9 Mar 2022 14:11:21 +0100 Subject: moonjit support --- src/linda.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/linda.c') diff --git a/src/linda.c b/src/linda.c index 42cda51..637f909 100644 --- a/src/linda.c +++ b/src/linda.c @@ -795,16 +795,16 @@ static void* linda_id( lua_State* L, DeepOp op_) * just don't use L's allocF because we don't know which state will get the honor of GCing the linda */ // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly -#if USE_LUA_STATE_ALLOCATOR +#if USE_LUA_STATE_ALLOCATOR() { Universe* const U = universe_get(L); AllocatorDefinition* const allocD = &U->protected_allocator.definition; s = (struct s_Linda*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(struct s_Linda) + name_len); // terminating 0 is already included } -#else // USE_LUA_STATE_ALLOCATOR +#else // USE_LUA_STATE_ALLOCATOR() s = (struct s_Linda*)malloc(sizeof(struct s_Linda) + name_len); // terminating 0 is already included -#endif // USE_LUA_STATE_ALLOCATOR +#endif // USE_LUA_STATE_ALLOCATOR() if( s) { s->prelude.magic.value = DEEP_VERSION.value; @@ -838,16 +838,16 @@ static void* linda_id( lua_State* L, DeepOp op_) SIGNAL_FREE( &linda->read_happened); SIGNAL_FREE( &linda->write_happened); // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly -#if USE_LUA_STATE_ALLOCATOR +#if USE_LUA_STATE_ALLOCATOR() { Universe* const U = universe_get(L); AllocatorDefinition* const allocD = &U->protected_allocator.definition; allocD->allocF(allocD->allocUD, linda, sizeof(struct s_Linda) + strlen(linda->name), 0); } -#else // USE_LUA_STATE_ALLOCATOR +#else // USE_LUA_STATE_ALLOCATOR() free(linda); -#endif // USE_LUA_STATE_ALLOCATOR +#endif // USE_LUA_STATE_ALLOCATOR() return NULL; } -- cgit v1.2.3-55-g6feb