aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lgc.c b/lgc.c
index f1d00e09..cdfd6496 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.133 2002/03/26 18:55:50 roberto Exp roberto $ 2** $Id: lgc.c,v 1.134 2002/04/05 18:54:31 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*/
@@ -211,14 +211,13 @@ static void traversetable (GCState *st, Table *h) {
211 int weakkey = 0; 211 int weakkey = 0;
212 int weakvalue = 0; 212 int weakvalue = 0;
213 marktable(st, h->metatable); 213 marktable(st, h->metatable);
214 lua_assert(h->lsizenode || h->node == G(st->L)->dummynode);
214 mode = fasttm(st->L, h->metatable, TM_WEAKMODE); 215 mode = fasttm(st->L, h->metatable, TM_WEAKMODE);
215 if (mode) { /* weak table? must be cleared after GC... */ 216 if (mode && ttype(mode) == LUA_TSTRING) { /* weak table? */
216 h->mark = st->toclear; /* put in the appropriate list */ 217 h->mark = st->toclear; /* must be cleared after GC, ... */
217 st->toclear = h; 218 st->toclear = h; /* ...put in the appropriate list */
218 if (ttype(mode) == LUA_TSTRING) { 219 weakkey = (strchr(svalue(mode), 'k') != NULL);
219 weakkey = (strchr(svalue(mode), 'k') != NULL); 220 weakvalue = (strchr(svalue(mode), 'v') != NULL);
220 weakvalue = (strchr(svalue(mode), 'v') != NULL);
221 }
222 } 221 }
223 if (!weakvalue) { 222 if (!weakvalue) {
224 i = sizearray(h); 223 i = sizearray(h);