diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-12-28 10:55:41 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-12-28 10:55:41 -0200 |
commit | 0183b8030c80f57b87874ff7867ccdb172d9d3dc (patch) | |
tree | 1033b5a84489a2f1f1bd210b1b120155cd7aeed7 /ltm.c | |
parent | 8c49e198654567f770a7d5081b886a7c35201d81 (diff) | |
download | lua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.tar.gz lua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.tar.bz2 lua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.zip |
`free' gets size of the block: complete control over memory use
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.57 2000/11/30 18:50:47 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.58 2000/12/26 18:46:09 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -75,9 +75,8 @@ static void init_entry (lua_State *L, int tag) { | |||
75 | 75 | ||
76 | void luaT_init (lua_State *L) { | 76 | void luaT_init (lua_State *L) { |
77 | int t; | 77 | int t; |
78 | L->TMtable = luaM_newvector(L, NUM_TAGS+2, struct TM); | ||
78 | L->sizeTM = NUM_TAGS+2; | 79 | L->sizeTM = NUM_TAGS+2; |
79 | L->TMtable = luaM_newvector(L, L->sizeTM, struct TM); | ||
80 | L->nblocks += NUM_TAGS*sizeof(struct TM); | ||
81 | L->ntag = NUM_TAGS; | 80 | L->ntag = NUM_TAGS; |
82 | for (t=0; t<L->ntag; t++) | 81 | for (t=0; t<L->ntag; t++) |
83 | init_entry(L, t); | 82 | init_entry(L, t); |
@@ -87,7 +86,6 @@ void luaT_init (lua_State *L) { | |||
87 | LUA_API int lua_newtag (lua_State *L) { | 86 | LUA_API int lua_newtag (lua_State *L) { |
88 | luaM_growvector(L, L->TMtable, L->ntag, L->sizeTM, struct TM, | 87 | luaM_growvector(L, L->TMtable, L->ntag, L->sizeTM, struct TM, |
89 | MAX_INT, "tag table overflow"); | 88 | MAX_INT, "tag table overflow"); |
90 | L->nblocks += sizeof(struct TM); | ||
91 | init_entry(L, L->ntag); | 89 | init_entry(L, L->ntag); |
92 | return L->ntag++; | 90 | return L->ntag++; |
93 | } | 91 | } |