diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-11 15:57:19 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-11 15:57:19 -0300 |
| commit | b803c0600eb20f3d4e47fd7a9ceecb096abcd3c6 (patch) | |
| tree | e2cb54f144b403cea94d5775bc322bcc9feb7d7d /ltable.c | |
| parent | 8ac0bbf64b93a672c6f29c2d96d22d727035e9ed (diff) | |
| download | lua-b803c0600eb20f3d4e47fd7a9ceecb096abcd3c6.tar.gz lua-b803c0600eb20f3d4e47fd7a9ceecb096abcd3c6.tar.bz2 lua-b803c0600eb20f3d4e47fd7a9ceecb096abcd3c6.zip | |
details
Diffstat (limited to 'ltable.c')
| -rw-r--r-- | ltable.c | 19 |
1 files changed, 6 insertions, 13 deletions
| @@ -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 | 125 | static void setnodevector (lua_State *L, Hash *t, int size) { | |
| 126 | static 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 | |||
| 137 | static 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); |
