MCPcopy Create free account
hub / github.com/DFHack/dfhack / separatetobefnz

Function separatetobefnz

depends/lua/src/lgc.c:880–895  ·  view source on GitHub ↗

** move all unreachable objects (or 'all' objects) that need ** finalization from list 'finobj' to list 'tobefnz' (to be finalized) */

Source from the content-addressed store, hash-verified

878** finalization from list 'finobj' to list 'tobefnz' (to be finalized)
879*/
880static void separatetobefnz (global_State *g, int all) {
881 GCObject *curr;
882 GCObject **p = &g->finobj;
883 GCObject **lastnext = findlast(&g->tobefnz);
884 while ((curr = *p) != NULL) { /* traverse all finalizable objects */
885 lua_assert(tofinalize(curr));
886 if (!(iswhite(curr) || all)) /* not being collected? */
887 p = &curr->next; /* don't bother with it */
888 else {
889 *p = curr->next; /* remove 'curr' from 'finobj' list */
890 curr->next = *lastnext; /* link at the end of 'tobefnz' list */
891 *lastnext = curr;
892 lastnext = &curr->next;
893 }
894 }
895}
896
897
898/*

Callers 2

luaC_freeallobjectsFunction · 0.85
atomicFunction · 0.85

Calls 1

findlastFunction · 0.85

Tested by

no test coverage detected