/* sweep at most 'count' elements from a list of GCObjects erasing dead objects, where a dead object is one marked with the old (non current) white; change all non-dead objects back to white, preparing for next collection cycle. Return where to continue the traversal or NULL if list is finished.  */
static GCObject ** sweeplist(lua_State *L, GCObject **p, lu_mem count)
/* sweep at most 'count' elements from a list of GCObjects erasing dead objects, where a dead object is one marked with the old (non current) white; change all non-dead objects back to white, preparing for next collection cycle. Return where to continue the traversal or NULL if list is finished.  */
static GCObject ** sweeplist(lua_State *L, GCObject **p, lu_mem count)
{
    GCObject *curr = *p;
    int marked = curr->marked;
    if (isdeadm(ow, marked)) {
      *p = curr->next;
      freeobj(L, curr);
    }
    else {
      curr->marked = cast_byte((marked & maskcolors) | white);
      p = &curr->next;
    }
  }
  return (*p == NULL) ? NULL : p;
}