aboutsummaryrefslogtreecommitdiff
path: root/src/linda.c
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2018-11-15 11:20:14 +0100
committerBenoit Germain <bnt.germain@gmail.com>2018-11-15 11:20:14 +0100
commit01f83215a2ad235fbf306f591c6c0547b1bb7047 (patch)
tree51d1edff1c3f684bac388c64d91ee30d8f6fbbf2 /src/linda.c
parent55acf8e19728ac39581c35f1324debf9449bd185 (diff)
downloadlanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.tar.gz
lanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.tar.bz2
lanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.zip
Deep userdata must embed DeepPrelude to save an allocation (also changes Deep protocol)
Diffstat (limited to 'src/linda.c')
-rw-r--r--src/linda.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/linda.c b/src/linda.c
index 98d2a8e..ee60ebc 100644
--- a/src/linda.c
+++ b/src/linda.c
@@ -46,6 +46,7 @@ THE SOFTWARE.
46*/ 46*/
47struct s_Linda 47struct s_Linda
48{ 48{
49 DeepPrelude prelude; // Deep userdata MUST start with this header
49 SIGNAL_T read_happened; 50 SIGNAL_T read_happened;
50 SIGNAL_T write_happened; 51 SIGNAL_T write_happened;
51 Universe* U; // the universe this linda belongs to 52 Universe* U; // the universe this linda belongs to
@@ -794,6 +795,7 @@ static void* linda_id( lua_State* L, DeepOp op_)
794 s = (struct s_Linda*) malloc( sizeof(struct s_Linda) + name_len); // terminating 0 is already included 795 s = (struct s_Linda*) malloc( sizeof(struct s_Linda) + name_len); // terminating 0 is already included
795 if( s) 796 if( s)
796 { 797 {
798 s->prelude.magic.value = DEEP_VERSION.value;
797 SIGNAL_INIT( &s->read_happened); 799 SIGNAL_INIT( &s->read_happened);
798 SIGNAL_INIT( &s->write_happened); 800 SIGNAL_INIT( &s->write_happened);
799 s->U = universe_get( L); 801 s->U = universe_get( L);
@@ -895,8 +897,7 @@ static void* linda_id( lua_State* L, DeepOp op_)
895 push_unique_key( L, NIL_SENTINEL); 897 push_unique_key( L, NIL_SENTINEL);
896 lua_setfield(L, -2, "null"); 898 lua_setfield(L, -2, "null");
897 899
898 luaG_pushdeepversion( L); 900 STACK_END( L, 1);
899 STACK_END( L, 2);
900 return NULL; 901 return NULL;
901 } 902 }
902 903