| 44 | } |
| 45 | |
| 46 | staticfn int |
| 47 | l_obj_gc(lua_State *L) |
| 48 | { |
| 49 | struct obj *obj, *otmp; |
| 50 | struct _lua_obj *lo = l_obj_check(L, 1); |
| 51 | |
| 52 | if (lo && (obj = lo->obj) != 0) { |
| 53 | if (obj->lua_ref_cnt > 0) |
| 54 | obj->lua_ref_cnt--; |
| 55 | /* free-floating objects with no other refs are deallocated. */ |
| 56 | if (!obj->lua_ref_cnt |
| 57 | && (obj->where == OBJ_FREE || obj->where == OBJ_LUAFREE)) { |
| 58 | if (Has_contents(obj)) { |
| 59 | while ((otmp = obj->cobj) != 0) { |
| 60 | obj_extract_self(otmp); |
| 61 | dealloc_obj(otmp); |
| 62 | } |
| 63 | } |
| 64 | obj->where = OBJ_FREE; |
| 65 | dealloc_obj(obj), obj = 0; |
| 66 | } |
| 67 | lo->obj = NULL; |
| 68 | } |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | staticfn struct _lua_obj * |
| 73 | l_obj_push(lua_State *L, struct obj *otmp) |
nothing calls this directly
no test coverage detected