diff options
Diffstat (limited to 'src/keeper.c')
-rw-r--r-- | src/keeper.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/keeper.c b/src/keeper.c index 8da3c08..99f510b 100644 --- a/src/keeper.c +++ b/src/keeper.c | |||
@@ -567,8 +567,7 @@ void close_keepers( void) | |||
567 | char const* init_keepers( lua_State* L) | 567 | char const* init_keepers( lua_State* L) |
568 | { | 568 | { |
569 | int i; | 569 | int i; |
570 | void* allocUD; | 570 | PROPAGATE_ALLOCF_PREP( L); |
571 | lua_Alloc allocF = lua_getallocf( L, &allocUD); | ||
572 | 571 | ||
573 | STACK_CHECK( L); | 572 | STACK_CHECK( L); |
574 | lua_getfield( L, 1, "nb_keepers"); | 573 | lua_getfield( L, 1, "nb_keepers"); |
@@ -580,10 +579,10 @@ char const* init_keepers( lua_State* L) | |||
580 | GKeepers = malloc( GNbKeepers * sizeof( struct s_Keeper)); | 579 | GKeepers = malloc( GNbKeepers * sizeof( struct s_Keeper)); |
581 | for( i = 0; i < GNbKeepers; ++ i) | 580 | for( i = 0; i < GNbKeepers; ++ i) |
582 | { | 581 | { |
583 | lua_State* K = lua_newstate( allocF, allocUD); | 582 | lua_State* K = PROPAGATE_ALLOCF_ALLOC(); |
584 | if( K == NULL) | 583 | if( K == NULL) |
585 | { | 584 | { |
586 | (void) luaL_error( L, "'lua_newstate()' failed while creating keeper state; out of memory"); | 585 | (void) luaL_error( L, "init_keepers() failed while creating keeper state; out of memory"); |
587 | } | 586 | } |
588 | STACK_CHECK( K); | 587 | STACK_CHECK( K); |
589 | 588 | ||
@@ -627,7 +626,7 @@ struct s_Keeper* keeper_acquire( void const* ptr) | |||
627 | * have to cast to unsigned long to avoid compilation warnings about loss of data when converting pointer-to-integer | 626 | * have to cast to unsigned long to avoid compilation warnings about loss of data when converting pointer-to-integer |
628 | */ | 627 | */ |
629 | unsigned int i = (unsigned int)(((unsigned long)(ptr) >> 3) % GNbKeepers); | 628 | unsigned int i = (unsigned int)(((unsigned long)(ptr) >> 3) % GNbKeepers); |
630 | struct s_Keeper* K = &GKeepers[i]; | 629 | struct s_Keeper *K= &GKeepers[i]; |
631 | 630 | ||
632 | MUTEX_LOCK( &K->lock_); | 631 | MUTEX_LOCK( &K->lock_); |
633 | //++ K->count; | 632 | //++ K->count; |