summaryrefslogtreecommitdiff
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-github-26d1e21c89a481c2368ba934da8e192a164d8f99.tar.gz
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 @@
/*
-** $Id: ltm.c,v 1.20 1999/01/15 13:11:57 roberto Exp roberto $
+** $Id: ltm.c,v 1.21 1999/02/04 18:59:31 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -58,9 +58,9 @@ static void init_entry (int tag) {
void luaT_init (void) {
int t;
- L->IMtable_size = NUM_TAGS*2;
L->last_tag = -(NUM_TAGS-1);
- L->IMtable = luaM_newvector(L->IMtable_size, struct IM);
+ L->IMtable = luaM_growvector(L->IMtable, 0, NUM_TAGS,
+ struct IM, memEM, MAX_INT);
for (t=L->last_tag; t<=0; t++)
init_entry(t);
}
@@ -68,9 +68,8 @@ void luaT_init (void) {
int lua_newtag (void) {
--L->last_tag;
- if ((-L->last_tag) >= L->IMtable_size)
- L->IMtable_size = luaM_growvector(&L->IMtable, L->IMtable_size,
- struct IM, memEM, MAX_INT);
+ L->IMtable = luaM_growvector(L->IMtable, -(L->last_tag), 1,
+ struct IM, memEM, MAX_INT);
init_entry(L->last_tag);
return L->last_tag;
}