aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keeper.c')
-rw-r--r--src/keeper.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/keeper.c b/src/keeper.c
index 6b3a810..3211c1b 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 LUAJIT_FLAVOR == 0 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( 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 // LUAJIT_FLAVOR 620#else // USE_LUA_STATE_ALLOCATOR
621 free(U->keepers); 621 free(U->keepers);
622#endif // LUAJIT_FLAVOR 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 LUAJIT_FLAVOR == 0 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( allocUD, NULL, 0, bytes); 660 U->keepers = (Keepers*) allocD->allocF( allocD->allocUD, NULL, 0, bytes);
661 } 661 }
662#else // LUAJIT_FLAVOR 662#else // USE_LUA_STATE_ALLOCATOR
663 U->keepers = (Keepers*)malloc(bytes); 663 U->keepers = (Keepers*)malloc(bytes);
664#endif // LUAJIT_FLAVOR 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");