/* Move all unreachable objects (or 'all' objects) that need finalization from list 'finobj' to list 'tobefnz' (to be finalized). (Note that objects after 'finobjold1' cannot be white, so they don't need to be traversed. In incremental mode, 'finobjold1' is NULL, so the whole list is traversed.)  */
static void separatetobefnz(global_State *g, int all)
/* Move all unreachable objects (or 'all' objects) that need finalization from list 'finobj' to list 'tobefnz' (to be finalized). (Note that objects after 'finobjold1' cannot be white, so they don't need to be traversed. In incremental mode, 'finobjold1' is NULL, so the whole list is traversed.)  */
static void separatetobefnz(global_State *g, int all)
{
    lua_assert(tofinalize(curr));
    if (!(iswhite(curr) || all))
      p = &curr->next;
    else {
      if (curr == g->finobjsur)
        g->finobjsur = curr->next;
      *p = curr->next;
      curr->next = *lastnext;
      *lastnext = curr;
      lastnext = &curr->next;
    }
  }
}