MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / clearbyvalues

Function clearbyvalues

3rd/lua-5.4.3/src/lgc.c:736–754  ·  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

734** to element 'f'
735*/
736static void clearbyvalues (global_State *g, GCObject *l, GCObject *f) {
737 for (; l != f; l = gco2t(l)->gclist) {
738 Table *h = gco2t(l);
739 Node *n, *limit = gnodelast(h);
740 unsigned int i;
741 unsigned int asize = luaH_realasize(h);
742 for (i = 0; i < asize; i++) {
743 TValue *o = &h->array[i];
744 if (iscleared(g, gcvalueN(o))) /* value was collected? */
745 setempty(o); /* remove entry */
746 }
747 for (n = gnode(h, 0); n < limit; n++) {
748 if (iscleared(g, gcvalueN(gval(n)))) /* unmarked value? */
749 setempty(gval(n)); /* remove entry */
750 if (isempty(gval(n))) /* is entry empty? */
751 clearkey(n); /* clear its key */
752 }
753 }
754}
755
756
757static 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