aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-06-06 15:00:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-06-06 15:00:19 -0300
commitd5b83ead90fba27faa344c72406d85987d2460a4 (patch)
tree96d73c1b872b6b01a28c0586b871d37185034ba9 /lstate.c
parentda673d31aaa05e8dff60c0b601b9f15c4f9182a8 (diff)
downloadlua-d5b83ead90fba27faa344c72406d85987d2460a4.tar.gz
lua-d5b83ead90fba27faa344c72406d85987d2460a4.tar.bz2
lua-d5b83ead90fba27faa344c72406d85987d2460a4.zip
new implementation for userdatas, without `keys'
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lstate.c b/lstate.c
index 63e15283..194e92c1 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.61 2001/03/26 14:31:49 roberto Exp roberto $ 2** $Id: lstate.c,v 1.62 2001/04/17 17:35:54 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -49,14 +49,15 @@ static void f_luaopen (lua_State *L, void *ud) {
49 } 49 }
50 else { /* create a new global state */ 50 else { /* create a new global state */
51 L->G = luaM_new(L, global_State); 51 L->G = luaM_new(L, global_State);
52 G(L)->strt.size = G(L)->udt.size = 0; 52 G(L)->strt.size = 0;
53 G(L)->strt.nuse = G(L)->udt.nuse = 0; 53 G(L)->strt.nuse = 0;
54 G(L)->strt.hash = G(L)->udt.hash = NULL; 54 G(L)->strt.hash = NULL;
55 G(L)->Mbuffer = NULL; 55 G(L)->Mbuffer = NULL;
56 G(L)->Mbuffsize = 0; 56 G(L)->Mbuffsize = 0;
57 G(L)->rootproto = NULL; 57 G(L)->rootproto = NULL;
58 G(L)->rootcl = NULL; 58 G(L)->rootcl = NULL;
59 G(L)->roottable = NULL; 59 G(L)->roottable = NULL;
60 G(L)->rootudata = NULL;
60 G(L)->TMtable = NULL; 61 G(L)->TMtable = NULL;
61 G(L)->sizeTM = 0; 62 G(L)->sizeTM = 0;
62 G(L)->ntag = 0; 63 G(L)->ntag = 0;
@@ -67,7 +68,7 @@ static void f_luaopen (lua_State *L, void *ud) {
67 G(L)->registry = luaH_new(L, 0); 68 G(L)->registry = luaH_new(L, 0);
68 G(L)->weakregistry = luaH_new(L, 0); 69 G(L)->weakregistry = luaH_new(L, 0);
69 G(L)->weakregistry->weakmode = LUA_WEAK_VALUE; /* make weakregistry weak */ 70 G(L)->weakregistry->weakmode = LUA_WEAK_VALUE; /* make weakregistry weak */
70 luaS_init(L); 71 luaS_resize(L, MINPOWER2);
71 luaX_init(L); 72 luaX_init(L);
72 luaT_init(L); 73 luaT_init(L);
73 G(L)->GCthreshold = 4*G(L)->nblocks; 74 G(L)->GCthreshold = 4*G(L)->nblocks;
@@ -115,6 +116,7 @@ static void close_state (lua_State *L, lua_State *OL) {
115 lua_assert(G(L)->rootproto == NULL); 116 lua_assert(G(L)->rootproto == NULL);
116 lua_assert(G(L)->rootcl == NULL); 117 lua_assert(G(L)->rootcl == NULL);
117 lua_assert(G(L)->roottable == NULL); 118 lua_assert(G(L)->roottable == NULL);
119 lua_assert(G(L)->rootudata == NULL);
118 luaS_freeall(L); 120 luaS_freeall(L);
119 luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM); 121 luaM_freearray(L, G(L)->TMtable, G(L)->sizeTM, struct TM);
120 luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char); 122 luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, l_char);