diff options
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools.c b/src/tools.c index 5a6ae92..80e0f71 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -155,6 +155,7 @@ void luaG_dump( lua_State* L) | |||
155 | 155 | ||
156 | // ################################################################################################ | 156 | // ################################################################################################ |
157 | 157 | ||
158 | // same as PUC-Lua l_alloc | ||
158 | static void* libc_lua_Alloc(void* ud, void* ptr, size_t osize, size_t nsize) | 159 | static void* libc_lua_Alloc(void* ud, void* ptr, size_t osize, size_t nsize) |
159 | { | 160 | { |
160 | (void)ud; (void)osize; /* not used */ | 161 | (void)ud; (void)osize; /* not used */ |
@@ -182,7 +183,7 @@ static void* protected_lua_Alloc( void *ud, void *ptr, size_t osize, size_t nsiz | |||
182 | static int luaG_provide_protected_allocator( lua_State* L) | 183 | static int luaG_provide_protected_allocator( lua_State* L) |
183 | { | 184 | { |
184 | Universe* U = universe_get( L); | 185 | Universe* U = universe_get( L); |
185 | AllocatorDefinition* def = lua_newuserdatauv( L, sizeof(AllocatorDefinition), 0); | 186 | AllocatorDefinition* const def = lua_newuserdatauv( L, sizeof(AllocatorDefinition), 0); |
186 | def->allocF = protected_lua_Alloc; | 187 | def->allocF = protected_lua_Alloc; |
187 | def->allocUD = &U->protected_allocator; | 188 | def->allocUD = &U->protected_allocator; |
188 | return 1; | 189 | return 1; |
@@ -236,7 +237,7 @@ void initialize_allocator_function( Universe* U, lua_State* L) | |||
236 | lua_getfield( L, -1, "internal_allocator"); // settings "libc"|"allocator" | 237 | lua_getfield( L, -1, "internal_allocator"); // settings "libc"|"allocator" |
237 | { | 238 | { |
238 | char const* allocator = lua_tostring( L, -1); | 239 | char const* allocator = lua_tostring( L, -1); |
239 | if (stricmp(allocator, "libc") == 0) | 240 | if (strcmp(allocator, "libc") == 0) |
240 | { | 241 | { |
241 | U->internal_allocator.allocF = libc_lua_Alloc; | 242 | U->internal_allocator.allocF = libc_lua_Alloc; |
242 | U->internal_allocator.allocUD = NULL; | 243 | U->internal_allocator.allocUD = NULL; |