diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-12 14:47:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-12 14:47:23 +0000 |
commit | d410639a6d422e0ae032f049ccfbbbb45b312d6f (patch) | |
tree | 7f967d0f5320dea31975c536b705cedc1db23db5 /gc.c | |
parent | 17c48bebf87828abeb5be91ed8ba0a2b72bc5479 (diff) | |
download | ruby-d410639a6d422e0ae032f049ccfbbbb45b312d6f.tar.gz |
* compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
(run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
(rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
thread.c (rb_thread_local_aref),
variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
(rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
ext/iconv/iconv.c (map_charset): use st_data_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -2699,6 +2699,7 @@ define_final(int argc, VALUE *argv, VALUE os) { rb_objspace_t *objspace = &rb_objspace; VALUE obj, block, table; + st_data_t data; rb_scan_args(argc, argv, "11", &obj, &block); if (OBJ_FROZEN(obj)) rb_error_frozen("object"); @@ -2721,7 +2722,8 @@ define_final(int argc, VALUE *argv, VALUE os) if (!finalizer_table) { finalizer_table = st_init_numtable(); } - if (st_lookup(finalizer_table, obj, &table)) { + if (st_lookup(finalizer_table, obj, &data)) { + table = (VALUE)data; rb_ary_push(table, block); } else { @@ -2737,10 +2739,12 @@ rb_gc_copy_finalizer(VALUE dest, VALUE obj) { rb_objspace_t *objspace = &rb_objspace; VALUE table; + st_data_t data; if (!finalizer_table) return; if (!FL_TEST(obj, FL_FINALIZE)) return; - if (st_lookup(finalizer_table, obj, &table)) { + if (st_lookup(finalizer_table, obj, &data)) { + table = (VALUE)data; st_insert(finalizer_table, dest, table); } FL_SET(dest, FL_FINALIZE); @@ -2777,8 +2781,9 @@ run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE objid, VALUE table) static void run_final(rb_objspace_t *objspace, VALUE obj) { - VALUE table, objid; + VALUE objid; RUBY_DATA_FUNC free_func = 0; + st_data_t key, table; objid = rb_obj_id(obj); /* make obj into id */ RBASIC(obj)->klass = 0; @@ -2793,9 +2798,10 @@ run_final(rb_objspace_t *objspace, VALUE obj) (*free_func)(DATA_PTR(obj)); } + key = (st_data_t)obj; if (finalizer_table && - st_delete(finalizer_table, (st_data_t*)&obj, &table)) { - run_finalizer(objspace, obj, objid, table); + st_delete(finalizer_table, &key, &table)) { + run_finalizer(objspace, obj, objid, (VALUE)table); } } |