aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-22 14:57:46 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-22 14:57:46 -0200
commit0066bbbb0b882dab02909563c112a75626477a02 (patch)
treebbf8ca2c93eec7cfa26338aae958c5f7eba63d8f
parent1db05793a0793ae0b64cf809d4d1c4f98dba064a (diff)
downloadlua-0066bbbb0b882dab02909563c112a75626477a02.tar.gz
lua-0066bbbb0b882dab02909563c112a75626477a02.tar.bz2
lua-0066bbbb0b882dab02909563c112a75626477a02.zip
details
-rw-r--r--lstring.c8
-rw-r--r--ltable.c8
2 files changed, 6 insertions, 10 deletions
diff --git a/lstring.c b/lstring.c
index 344276b8..05e5bbaa 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 1.45 2000/10/30 17:49:19 roberto Exp roberto $ 2** $Id: lstring.c,v 1.46 2000/11/24 17:39:56 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -72,10 +72,8 @@ void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
72 } 72 }
73 } 73 }
74 luaM_free(L, tb->hash); 74 luaM_free(L, tb->hash);
75 if (newsize > tb->size) /* avoid "unsigned negative" values */ 75 L->nblocks -= tb->size*sizeof(TString *);
76 L->nblocks += (newsize - tb->size)*sizeof(TString *); 76 L->nblocks += newsize*sizeof(TString *);
77 else
78 L->nblocks -= (tb->size - newsize)*sizeof(TString *);
79 tb->size = newsize; 77 tb->size = newsize;
80 tb->hash = newhash; 78 tb->hash = newhash;
81} 79}
diff --git a/ltable.c b/ltable.c
index f9ccdd6c..82f47808 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.59 2000/11/24 17:39:56 roberto Exp roberto $ 2** $Id: ltable.c,v 1.60 2000/12/04 18:33:40 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -167,10 +167,8 @@ static void setnodevector (lua_State *L, Hash *t, luint32 size) {
167 ttype(&t->node[i].key) = ttype(&t->node[i].val) = LUA_TNIL; 167 ttype(&t->node[i].key) = ttype(&t->node[i].val) = LUA_TNIL;
168 t->node[i].next = NULL; 168 t->node[i].next = NULL;
169 } 169 }
170 if ((int)size > t->size) /* avoid "unsigned negative" values */ 170 L->nblocks -= gcsize(L, t->size); /* old size */
171 L->nblocks += gcsize(L, size) - gcsize(L, t->size); 171 L->nblocks += gcsize(L, size); /* new size */
172 else
173 L->nblocks -= gcsize(L, t->size) - gcsize(L, size);
174 t->size = size; 172 t->size = size;
175 t->firstfree = &t->node[size-1]; /* first free position to be used */ 173 t->firstfree = &t->node[size-1]; /* first free position to be used */
176} 174}