MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / cleartable

Function cleartable

Source/Misc/lua/src/lua.c:6353–6377  ·  view source on GitHub ↗

** clear collected entries from weaktables */

Source from the content-addressed store, hash-verified

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

Callers 1

atomicFunction · 0.85

Calls 2

isclearedFunction · 0.85
removeentryFunction · 0.85

Tested by

no test coverage detected