** clear entries with unmarked values from all weaktables in list 'l' up ** to element 'f' */
| 742 | ** to element 'f' |
| 743 | */ |
| 744 | static void clearbyvalues (global_State *g, GCObject *l, GCObject *f) { |
| 745 | for (; l != f; l = gco2t(l)->gclist) { |
| 746 | Table *h = gco2t(l); |
| 747 | Node *n, *limit = gnodelast(h); |
| 748 | unsigned int i; |
| 749 | unsigned int asize = luaH_realasize(h); |
| 750 | for (i = 0; i < asize; i++) { |
| 751 | TValue *o = &h->array[i]; |
| 752 | if (iscleared(g, gcvalueN(o))) /* value was collected? */ |
| 753 | setempty(o); /* remove entry */ |
| 754 | } |
| 755 | for (n = gnode(h, 0); n < limit; n++) { |
| 756 | if (iscleared(g, gcvalueN(gval(n)))) /* unmarked value? */ |
| 757 | setempty(gval(n)); /* remove entry */ |
| 758 | if (isempty(gval(n))) /* is entry empty? */ |
| 759 | clearkey(n); /* clear its key */ |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | |
| 765 | static void freeupval (lua_State *L, UpVal *uv) { |
no test coverage detected