1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00

in 'clearbykeys', clear keys of just-removed entries too

This commit is contained in:
Roberto Ierusalimschy 2018-02-23 10:21:27 -03:00
parent 9243c414d9
commit 4a7fe61806

6
lgc.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lgc.c,v 2.248 2018/02/20 16:52:50 roberto Exp roberto $ ** $Id: lgc.c,v 2.250 2018/02/23 13:16:18 roberto Exp roberto $
** Garbage Collector ** Garbage Collector
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -688,10 +688,10 @@ static void clearbykeys (global_State *g, GCObject *l) {
Node *limit = gnodelast(h); Node *limit = gnodelast(h);
Node *n; Node *n;
for (n = gnode(h, 0); n < limit; n++) { for (n = gnode(h, 0); n < limit; n++) {
if (iscleared(g, gckeyN(n))) /* unmarked key? */
setempty(gval(n)); /* remove entry */
if (isempty(gval(n))) /* is entry empty? */ if (isempty(gval(n))) /* is entry empty? */
clearkey(n); /* clear its key */ clearkey(n); /* clear its key */
else if (iscleared(g, gckeyN(n))) /* unmarked key? */
setempty(gval(n)); /* remove entry */
} }
} }
} }