/* move all unreachable objects (or 'all' objects) that need finalization from list 'finobj' to list 'tobefnz' (to be finalized)  */
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)  */
static void separatetobefnz(global_State *g, int all)
{
    lua_assert(tofinalize(curr));
    if (!(iswhite(curr) || all))
      p = &curr->next;
    else {
      *p = curr->next;
      curr->next = *lastnext;
      *lastnext = curr;
      lastnext = &curr->next;
    }
  }
}