** clear collected entries from weaktables */
| 6351 | ** clear collected entries from weaktables |
| 6352 | */ |
| 6353 | static void cleartable (GCObject *l) { |
| 6354 | while (l) { |
| 6355 | Table *h = gco2h(l); |
| 6356 | int i = h->sizearray; |
| 6357 | lua_assert(testbit(h->marked, VALUEWEAKBIT) || |
| 6358 | testbit(h->marked, KEYWEAKBIT)); |
| 6359 | if (testbit(h->marked, VALUEWEAKBIT)) { |
| 6360 | while (i--) { |
| 6361 | TValue *o = &h->array[i]; |
| 6362 | if (iscleared(o, 0)) /* value was collected? */ |
| 6363 | setnilvalue(o); /* remove value */ |
| 6364 | } |
| 6365 | } |
| 6366 | i = sizenode(h); |
| 6367 | while (i--) { |
| 6368 | Node *n = gnode(h, i); |
| 6369 | if (!ttisnil(gval(n)) && /* non-empty entry? */ |
| 6370 | (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { |
| 6371 | setnilvalue(gval(n)); /* remove value ... */ |
| 6372 | removeentry(n); /* remove entry from table */ |
| 6373 | } |
| 6374 | } |
| 6375 | l = h->gclist; |
| 6376 | } |
| 6377 | } |
| 6378 | |
| 6379 | |
| 6380 | static void freeobj (lua_State *L, GCObject *o) { |
no test coverage detected