diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-25 14:45:36 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-25 14:45:36 -0200 |
| commit | a53d9b66ca6247818acaf41e28cdf123082a272b (patch) | |
| tree | 8e909200d4d925fc7394e6adf83cc5941456c588 /ltable.c | |
| parent | c8559e3c8d12e052783e2952db1372c68cc16059 (diff) | |
| download | lua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.gz lua-a53d9b66ca6247818acaf41e28cdf123082a272b.tar.bz2 lua-a53d9b66ca6247818acaf41e28cdf123082a272b.zip | |
first implementation for type names
Diffstat (limited to 'ltable.c')
| -rw-r--r-- | ltable.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 1.65 2001/01/19 13:20:30 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.66 2001/01/24 15:45:33 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 | */ |
| @@ -236,6 +236,7 @@ static TObject *newkey (lua_State *L, Hash *t, Node *mp, const TObject *key) { | |||
| 236 | othern->next = n; /* redo the chain with `n' in place of `mp' */ | 236 | othern->next = n; /* redo the chain with `n' in place of `mp' */ |
| 237 | *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ | 237 | *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ |
| 238 | mp->next = NULL; /* now `mp' is free */ | 238 | mp->next = NULL; /* now `mp' is free */ |
| 239 | setnilvalue(&mp->val); | ||
| 239 | } | 240 | } |
| 240 | else { /* colliding node is in its own main position */ | 241 | else { /* colliding node is in its own main position */ |
| 241 | /* new node will go into free position */ | 242 | /* new node will go into free position */ |
| @@ -245,6 +246,7 @@ static TObject *newkey (lua_State *L, Hash *t, Node *mp, const TObject *key) { | |||
| 245 | } | 246 | } |
| 246 | } | 247 | } |
| 247 | setobj(&mp->key, key); | 248 | setobj(&mp->key, key); |
| 249 | lua_assert(ttype(&mp->val) == LUA_TNIL); | ||
| 248 | for (;;) { /* correct `firstfree' */ | 250 | for (;;) { /* correct `firstfree' */ |
| 249 | if (ttype(&t->firstfree->key) == LUA_TNIL) | 251 | if (ttype(&t->firstfree->key) == LUA_TNIL) |
| 250 | return &mp->val; /* OK; table still has a free place */ | 252 | return &mp->val; /* OK; table still has a free place */ |
