aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keeper.c')
-rw-r--r--src/keeper.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/keeper.c b/src/keeper.c
index 3211c1b..19b9e1a 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -612,14 +612,14 @@ void close_keepers( Universe* U, lua_State* L)
612 // free the keeper bookkeeping structure 612 // free the keeper bookkeeping structure
613 { 613 {
614 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly 614 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly
615#if USE_LUA_STATE_ALLOCATOR 615#if USE_LUA_STATE_ALLOCATOR()
616 { 616 {
617 AllocatorDefinition* const allocD = &U->protected_allocator.definition; 617 AllocatorDefinition* const allocD = &U->protected_allocator.definition;
618 allocD->allocF( allocD->allocUD, U->keepers, sizeof( Keepers) + (nbKeepers - 1) * sizeof( Keeper), 0); 618 allocD->allocF( allocD->allocUD, U->keepers, sizeof( Keepers) + (nbKeepers - 1) * sizeof( Keeper), 0);
619 } 619 }
620#else // USE_LUA_STATE_ALLOCATOR 620#else // USE_LUA_STATE_ALLOCATOR()
621 free(U->keepers); 621 free(U->keepers);
622#endif // USE_LUA_STATE_ALLOCATOR 622#endif // USE_LUA_STATE_ALLOCATOR()
623 U->keepers = NULL; 623 U->keepers = NULL;
624 } 624 }
625 } 625 }
@@ -654,14 +654,14 @@ void init_keepers( Universe* U, lua_State* L)
654 { 654 {
655 size_t const bytes = sizeof( Keepers) + (nb_keepers - 1) * sizeof( Keeper); 655 size_t const bytes = sizeof( Keepers) + (nb_keepers - 1) * sizeof( Keeper);
656 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly 656 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly
657#if USE_LUA_STATE_ALLOCATOR 657#if USE_LUA_STATE_ALLOCATOR()
658 { 658 {
659 AllocatorDefinition* const allocD = &U->protected_allocator.definition; 659 AllocatorDefinition* const allocD = &U->protected_allocator.definition;
660 U->keepers = (Keepers*) allocD->allocF( allocD->allocUD, NULL, 0, bytes); 660 U->keepers = (Keepers*) allocD->allocF( allocD->allocUD, NULL, 0, bytes);
661 } 661 }
662#else // USE_LUA_STATE_ALLOCATOR 662#else // USE_LUA_STATE_ALLOCATOR()
663 U->keepers = (Keepers*)malloc(bytes); 663 U->keepers = (Keepers*)malloc(bytes);
664#endif // USE_LUA_STATE_ALLOCATOR 664#endif // USE_LUA_STATE_ALLOCATOR()
665 if( U->keepers == NULL) 665 if( U->keepers == NULL)
666 { 666 {
667 (void) luaL_error( L, "init_keepers() failed while creating keeper array; out of memory"); 667 (void) luaL_error( L, "init_keepers() failed while creating keeper array; out of memory");