diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2022-02-08 10:39:48 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2022-02-08 10:39:48 +0100 |
commit | 2c0000d5169cacf950d06637ada1a371cf382896 (patch) | |
tree | edfe62d964b98cc745d867f09feac2df2eab758f /deep_test/deep_test.c | |
parent | 54152c35e76acd1f21b477caf0a4403128032039 (diff) | |
download | lanes-2c0000d5169cacf950d06637ada1a371cf382896.tar.gz lanes-2c0000d5169cacf950d06637ada1a371cf382896.tar.bz2 lanes-2c0000d5169cacf950d06637ada1a371cf382896.zip |
__lanesclone is now called only once with 3 parameters dest, source, size -> BREAKS CUSTOM DEEP USERDATA API
Diffstat (limited to 'deep_test/deep_test.c')
-rw-r--r-- | deep_test/deep_test.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/deep_test/deep_test.c b/deep_test/deep_test.c index a725902..cb89741 100644 --- a/deep_test/deep_test.c +++ b/deep_test/deep_test.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <malloc.h> | 1 | #include <malloc.h> |
2 | #include <memory.h> | 2 | #include <memory.h> |
3 | #include <assert.h> | ||
3 | 4 | ||
4 | #include "lua.h" | 5 | #include "lua.h" |
5 | #include "lualib.h" | 6 | #include "lualib.h" |
@@ -196,18 +197,12 @@ static int clonable_lanesclone( lua_State* L) | |||
196 | { | 197 | { |
197 | switch( lua_gettop( L)) | 198 | switch( lua_gettop( L)) |
198 | { | 199 | { |
199 | case 1: | 200 | case 3: |
200 | { | ||
201 | // in case we need it to compute the amount of memory we need | ||
202 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); | ||
203 | lua_pushinteger( L, sizeof( struct s_MyClonableUserdata)); | ||
204 | } | ||
205 | return 1; | ||
206 | |||
207 | case 2: | ||
208 | { | 201 | { |
209 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); | 202 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); |
210 | struct s_MyClonableUserdata* from = lua_touserdata( L, 2); | 203 | struct s_MyClonableUserdata* from = lua_touserdata( L, 2); |
204 | size_t len = lua_tointeger( L, 3); | ||
205 | assert( len == sizeof(struct s_MyClonableUserdata)); | ||
211 | *self = *from; | 206 | *self = *from; |
212 | } | 207 | } |
213 | return 0; | 208 | return 0; |