aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lanes-3.16.1-0.rockspec (renamed from lanes-3.16.0-0.rockspec)4
-rw-r--r--src/keeper.c2
-rw-r--r--src/lanes.c6
-rw-r--r--src/linda.c6
-rw-r--r--src/state.c2
-rw-r--r--src/tools.c5
-rw-r--r--tests/basic.lua2
-rw-r--r--tests/linda_perf.lua2
8 files changed, 13 insertions, 16 deletions
diff --git a/lanes-3.16.0-0.rockspec b/lanes-3.16.1-0.rockspec
index 55bbfb4..65115a1 100644
--- a/lanes-3.16.0-0.rockspec
+++ b/lanes-3.16.1-0.rockspec
@@ -7,11 +7,11 @@
7 7
8package = "Lanes" 8package = "Lanes"
9 9
10version = "3.16.0-0" 10version = "3.16.1-0"
11 11
12source= { 12source= {
13 url= "git+https://github.com/LuaLanes/lanes.git", 13 url= "git+https://github.com/LuaLanes/lanes.git",
14 branch= "v3.16.0" 14 branch= "v3.16.1"
15} 15}
16 16
17description = { 17description = {
diff --git a/src/keeper.c b/src/keeper.c
index f4dde0a..8aa734a 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -612,7 +612,7 @@ void close_keepers( Universe* U)
612 // free the keeper bookkeeping structure 612 // free the keeper bookkeeping structure
613 { 613 {
614 AllocatorDefinition* const allocD = &U->internal_allocator; 614 AllocatorDefinition* const allocD = &U->internal_allocator;
615 allocD->allocF( allocD->allocUD, U->keepers, sizeof( Keepers) + (nbKeepers - 1) * sizeof( Keeper), 0); 615 (void) allocD->allocF( allocD->allocUD, U->keepers, sizeof( Keepers) + (nbKeepers - 1) * sizeof( Keeper), 0);
616 U->keepers = NULL; 616 U->keepers = NULL;
617 } 617 }
618 } 618 }
diff --git a/src/lanes.c b/src/lanes.c
index 0aab244..d2c95ee 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -255,7 +255,7 @@ static void lane_cleanup( Lane* s)
255 255
256 { 256 {
257 AllocatorDefinition* const allocD = &s->U->internal_allocator; 257 AllocatorDefinition* const allocD = &s->U->internal_allocator;
258 allocD->allocF(allocD->allocUD, s, sizeof(Lane), 0); 258 (void) allocD->allocF(allocD->allocUD, s, sizeof(Lane), 0);
259 } 259 }
260} 260}
261 261
@@ -1225,10 +1225,10 @@ LUAG_FUNC( lane_new)
1225 // 's' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread) 1225 // 's' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread)
1226 // 1226 //
1227 // a Lane full userdata needs a single uservalue 1227 // a Lane full userdata needs a single uservalue
1228 ud = lua_newuserdatauv( L, sizeof( Lane*), 1); // func libs priority globals package required gc_cb lane 1228 ud = lua_newuserdatauv( L, sizeof( Lane*), 1); // func libs priority globals package required gc_cb lane
1229 { 1229 {
1230 AllocatorDefinition* const allocD = &U->internal_allocator; 1230 AllocatorDefinition* const allocD = &U->internal_allocator;
1231 s = *ud = (Lane*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(Lane)); 1231 s = *ud = (Lane*) allocD->allocF(allocD->allocUD, NULL, 0, sizeof(Lane));
1232 } 1232 }
1233 if( s == NULL) 1233 if( s == NULL)
1234 { 1234 {
diff --git a/src/linda.c b/src/linda.c
index 390816b..8b59790 100644
--- a/src/linda.c
+++ b/src/linda.c
@@ -797,8 +797,7 @@ static void* linda_id( lua_State* L, DeepOp op_)
797 { 797 {
798 Universe* const U = universe_get(L); 798 Universe* const U = universe_get(L);
799 AllocatorDefinition* const allocD = &U->internal_allocator; 799 AllocatorDefinition* const allocD = &U->internal_allocator;
800 800 s = (struct s_Linda*) allocD->allocF(allocD->allocUD, NULL, 0, sizeof(struct s_Linda) + name_len); // terminating 0 is already included
801 s = (struct s_Linda*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(struct s_Linda) + name_len); // terminating 0 is already included
802 } 801 }
803 if( s) 802 if( s)
804 { 803 {
@@ -835,8 +834,7 @@ static void* linda_id( lua_State* L, DeepOp op_)
835 { 834 {
836 Universe* const U = universe_get(L); 835 Universe* const U = universe_get(L);
837 AllocatorDefinition* const allocD = &U->internal_allocator; 836 AllocatorDefinition* const allocD = &U->internal_allocator;
838 837 (void) allocD->allocF(allocD->allocUD, linda, sizeof(struct s_Linda) + strlen(linda->name), 0);
839 allocD->allocF(allocD->allocUD, linda, sizeof(struct s_Linda) + strlen(linda->name), 0);
840 } 838 }
841 return NULL; 839 return NULL;
842 } 840 }
diff --git a/src/state.c b/src/state.c
index ef70842..21ca397 100644
--- a/src/state.c
+++ b/src/state.c
@@ -259,7 +259,7 @@ lua_State* create_state( Universe* U, lua_State* from_)
259 lua_pushcclosure( from_, U->provide_allocator, 0); 259 lua_pushcclosure( from_, U->provide_allocator, 0);
260 lua_call( from_, 0, 1); 260 lua_call( from_, 0, 1);
261 { 261 {
262 AllocatorDefinition* def = lua_touserdata( from_, -1); 262 AllocatorDefinition* const def = lua_touserdata( from_, -1);
263 L = lua_newstate( def->allocF, def->allocUD); 263 L = lua_newstate( def->allocF, def->allocUD);
264 } 264 }
265 lua_pop( from_, 1); 265 lua_pop( from_, 1);
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
158static void* libc_lua_Alloc(void* ud, void* ptr, size_t osize, size_t nsize) 159static 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
182static int luaG_provide_protected_allocator( lua_State* L) 183static 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;
diff --git a/tests/basic.lua b/tests/basic.lua
index 7bbcbb3..385e22f 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -7,7 +7,7 @@
7-- - ... 7-- - ...
8-- 8--
9 9
10local require_lanes_result_1, require_lanes_result_2 = require "lanes".configure{ with_timers = false} 10local require_lanes_result_1, require_lanes_result_2 = require "lanes".configure{ with_timers = false, internal_allocator = "libc"}
11print( "require_lanes_result:", require_lanes_result_1, require_lanes_result_2) 11print( "require_lanes_result:", require_lanes_result_1, require_lanes_result_2)
12local lanes = require_lanes_result_1 12local lanes = require_lanes_result_1
13 13
diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua
index fa2d633..a170b01 100644
--- a/tests/linda_perf.lua
+++ b/tests/linda_perf.lua
@@ -78,7 +78,6 @@ end
78 78
79local tests1 = 79local tests1 =
80{ 80{
81 --[[
82 { 10000, 2000000, 0}, 81 { 10000, 2000000, 0},
83 { 10000, 2000000, 1}, 82 { 10000, 2000000, 1},
84 { 10000, 2000000, 2}, 83 { 10000, 2000000, 2},
@@ -88,7 +87,6 @@ local tests1 =
88 { 10000, 2000000, 13}, 87 { 10000, 2000000, 13},
89 { 10000, 2000000, 21}, 88 { 10000, 2000000, 21},
90 { 10000, 2000000, 44}, 89 { 10000, 2000000, 44},
91 --]]
92} 90}
93print "############################################\ntests #1" 91print "############################################\ntests #1"
94for k, v in pairs( tests1) do 92for k, v in pairs( tests1) do