aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-25 12:16:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-25 12:16:26 -0300
commit26d1e21c89a481c2368ba934da8e192a164d8f99 (patch)
treeea2eaaade79264b71d0e18fef75bca70fc1f4766 /ltm.c
parent24a2c08145ecc9b5c528a46ba83bdd7b95dbdc02 (diff)
downloadlua-26d1e21c89a481c2368ba934da8e192a164d8f99.tar.gz
lua-26d1e21c89a481c2368ba934da8e192a164d8f99.tar.bz2
lua-26d1e21c89a481c2368ba934da8e192a164d8f99.zip
new way to handle "growing" vectors
Diffstat (limited to 'ltm.c')
-rw-r--r--ltm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ltm.c b/ltm.c
index bc9d0faa..78620286 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.20 1999/01/15 13:11:57 roberto Exp roberto $ 2** $Id: ltm.c,v 1.21 1999/02/04 18:59:31 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*/
@@ -58,9 +58,9 @@ static void init_entry (int tag) {
58 58
59void luaT_init (void) { 59void luaT_init (void) {
60 int t; 60 int t;
61 L->IMtable_size = NUM_TAGS*2;
62 L->last_tag = -(NUM_TAGS-1); 61 L->last_tag = -(NUM_TAGS-1);
63 L->IMtable = luaM_newvector(L->IMtable_size, struct IM); 62 L->IMtable = luaM_growvector(L->IMtable, 0, NUM_TAGS,
63 struct IM, memEM, MAX_INT);
64 for (t=L->last_tag; t<=0; t++) 64 for (t=L->last_tag; t<=0; t++)
65 init_entry(t); 65 init_entry(t);
66} 66}
@@ -68,9 +68,8 @@ void luaT_init (void) {
68 68
69int lua_newtag (void) { 69int lua_newtag (void) {
70 --L->last_tag; 70 --L->last_tag;
71 if ((-L->last_tag) >= L->IMtable_size) 71 L->IMtable = luaM_growvector(L->IMtable, -(L->last_tag), 1,
72 L->IMtable_size = luaM_growvector(&L->IMtable, L->IMtable_size, 72 struct IM, memEM, MAX_INT);
73 struct IM, memEM, MAX_INT);
74 init_entry(L->last_tag); 73 init_entry(L->last_tag);
75 return L->last_tag; 74 return L->last_tag;
76} 75}