method
finalize
v2_5_5 -
Show latest stable
-
0 notes -
Class: WeakMap
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
finalize(p1)
private
Hide source
static VALUE wmap_finalize(VALUE self, VALUE objid) { st_data_t orig, wmap, data; VALUE obj, *rids, i, size; struct weakmap *w; TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w); /* Get reference from object id. */ obj = obj_id_to_ref(objid); /* obj is original referenced object and/or weak reference. */ orig = (st_data_t)obj; if (st_delete(w->obj2wmap, &orig, &data)) { rids = (VALUE *)data; size = *rids++; for (i = 0; i < size; ++i) { wmap = (st_data_t)rids[i]; st_delete(w->wmap2obj, &wmap, NULL); } ruby_sized_xfree((VALUE *)data, (size + 1) * sizeof(VALUE)); } wmap = (st_data_t)obj; if (st_delete(w->wmap2obj, &wmap, &orig)) { wmap = (st_data_t)obj; st_update(w->obj2wmap, orig, wmap_final_func, wmap); } return self; }