** Sweep a list of objects, deleting dead ones and turning ** the non dead to old (without changing their colors). */
| 974 | ** the non dead to old (without changing their colors). |
| 975 | */ |
| 976 | static void sweep2old (lua_State *L, GCObject **p) { |
| 977 | GCObject *curr; |
| 978 | while ((curr = *p) != NULL) { |
| 979 | if (iswhite(curr)) { /* is 'curr' dead? */ |
| 980 | lua_assert(isdead(G(L), curr)); |
| 981 | *p = curr->next; /* remove 'curr' from list */ |
| 982 | freeobj(L, curr); /* erase 'curr' */ |
| 983 | } |
| 984 | else { /* all surviving objects become old */ |
| 985 | setage(curr, G_OLD); |
| 986 | p = &curr->next; /* go to next element */ |
| 987 | } |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | |
| 992 | /* |