diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-05 17:07:53 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-05 17:07:53 -0300 |
commit | c542aac0b935a65203244c130cdfa700113f0bc8 (patch) | |
tree | 83719377490646a17c31ceb3cabb3111b713151a /lgc.c | |
parent | dbfb810267d8fd7ecf546ea1e1edc8892547e664 (diff) | |
download | lua-c542aac0b935a65203244c130cdfa700113f0bc8.tar.gz lua-c542aac0b935a65203244c130cdfa700113f0bc8.tar.bz2 lua-c542aac0b935a65203244c130cdfa700113f0bc8.zip |
collect dead indices in tables
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.53 2000/05/30 19:00:31 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.54 2000/06/05 14:56:18 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -64,6 +64,8 @@ static void tablemark (lua_State *L, Hash *h) { | |||
64 | for (i=h->size-1; i>=0; i--) { | 64 | for (i=h->size-1; i>=0; i--) { |
65 | Node *n = node(h,i); | 65 | Node *n = node(h,i); |
66 | if (ttype(key(n)) != TAG_NIL) { | 66 | if (ttype(key(n)) != TAG_NIL) { |
67 | if (ttype(val(n)) == TAG_NIL) | ||
68 | luaH_remove(h, key(n)); /* dead element; try to remove it */ | ||
67 | markobject(L, &n->key); | 69 | markobject(L, &n->key); |
68 | markobject(L, &n->val); | 70 | markobject(L, &n->val); |
69 | } | 71 | } |