MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / clearbyvalues

Function clearbyvalues

lib/lua/src/lgc.c:744–762  ·  view source on GitHub ↗

** clear entries with unmarked values from all weaktables in list 'l' up ** to element 'f' */

Source from the content-addressed store, hash-verified

742** to element 'f'
743*/
744static void clearbyvalues (global_State *g, GCObject *l, GCObject *f) {
745 for (; l != f; l = gco2t(l)->gclist) {
746 Table *h = gco2t(l);
747 Node *n, *limit = gnodelast(h);
748 unsigned int i;
749 unsigned int asize = luaH_realasize(h);
750 for (i = 0; i < asize; i++) {
751 TValue *o = &h->array[i];
752 if (iscleared(g, gcvalueN(o))) /* value was collected? */
753 setempty(o); /* remove entry */
754 }
755 for (n = gnode(h, 0); n < limit; n++) {
756 if (iscleared(g, gcvalueN(gval(n)))) /* unmarked value? */
757 setempty(gval(n)); /* remove entry */
758 if (isempty(gval(n))) /* is entry empty? */
759 clearkey(n); /* clear its key */
760 }
761 }
762}
763
764
765static void freeupval (lua_State *L, UpVal *uv) {

Callers 1

atomicFunction · 0.85

Calls 3

luaH_realasizeFunction · 0.85
isclearedFunction · 0.85
clearkeyFunction · 0.85

Tested by

no test coverage detected