aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/ltable.c b/ltable.c
index fb8b3dfe..3af51b62 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.40 2000/04/25 16:55:09 roberto Exp roberto $ 2** $Id: ltable.c,v 1.41 2000/05/08 19:32:53 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*/
@@ -122,20 +122,13 @@ int luaH_pos (lua_State *L, const Hash *t, const TObject *key) {
122} 122}
123 123
124 124
125 125static void setnodevector (lua_State *L, Hash *t, int size) {
126static Node *hashnodecreate (lua_State *L, int nhash) {
127 Node *v = luaM_newvector(L, nhash, Node);
128 int i; 126 int i;
129 for (i=0; i<nhash; i++) { 127 t->node = luaM_newvector(L, size, Node);
130 ttype(&v[i].key) = ttype(&v[i].val) = TAG_NIL; 128 for (i=0; i<size; i++) {
131 v[i].next = NULL; 129 ttype(&t->node[i].key) = ttype(&t->node[i].val) = TAG_NIL;
130 t->node[i].next = NULL;
132 } 131 }
133 return v;
134}
135
136
137static void setnodevector (lua_State *L, Hash *t, int size) {
138 t->node = hashnodecreate(L, size);
139 t->size = size; 132 t->size = size;
140 t->firstfree = &t->node[size-1]; /* first free position to be used */ 133 t->firstfree = &t->node[size-1]; /* first free position to be used */
141 L->nblocks += gcsize(L, size); 134 L->nblocks += gcsize(L, size);