From 24537e1b1cefa65b167bf2e1ce9813cba4c73b20 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 9 Nov 2013 23:03:11 +0000 Subject: [PATCH] gc.c: finalizer functions * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export finalizer functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ gc.c | 14 ++++++-------- include/ruby/intern.h | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index adc62a6d48..b013005c87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Nov 10 08:03:05 2013 Nobuyoshi Nakada + + * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export + finalizer functions. + Sun Nov 10 07:41:22 2013 Zachary Scott * lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439] diff --git a/gc.c b/gc.c index 4b0fb1c0a3..620f750a31 100644 --- a/gc.c +++ b/gc.c @@ -625,8 +625,6 @@ void rb_gcdebug_print_obj_condition(VALUE obj); static void rb_objspace_call_finalizer(rb_objspace_t *objspace); static VALUE define_final0(VALUE obj, VALUE block); -VALUE rb_define_final(VALUE obj, VALUE block); -VALUE rb_undefine_final(VALUE obj); static void negative_size_allocation_error(const char *); static void *aligned_malloc(size_t, size_t); @@ -1849,11 +1847,11 @@ os_each_obj(int argc, VALUE *argv, VALUE os) static VALUE undefine_final(VALUE os, VALUE obj) { - return rb_undefine_final(obj); + return rb_undefine_finalizer(obj); } VALUE -rb_undefine_final(VALUE obj) +rb_undefine_finalizer(VALUE obj) { rb_objspace_t *objspace = &rb_objspace; st_data_t data = obj; @@ -1927,7 +1925,7 @@ define_final0(VALUE obj, VALUE block) } VALUE -rb_define_final(VALUE obj, VALUE block) +rb_define_finalizer(VALUE obj, VALUE block) { rb_check_frozen(obj); should_be_callable(block); @@ -6006,8 +6004,8 @@ wmap_aset(VALUE self, VALUE wmap, VALUE orig) struct weakmap *w; TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w); - rb_define_final(orig, w->final); - rb_define_final(wmap, w->final); + rb_define_finalizer(orig, w->final); + rb_define_finalizer(wmap, w->final); if (st_lookup(w->obj2wmap, (st_data_t)orig, &data)) { rids = (VALUE)data; } @@ -6732,7 +6730,7 @@ gcdebug_sential(VALUE obj, VALUE name) void rb_gcdebug_sentinel(VALUE obj, const char *name) { - rb_define_final(obj, rb_proc_new(gcdebug_sential, (VALUE)name)); + rb_define_finalizer(obj, rb_proc_new(gcdebug_sential, (VALUE)name)); } #endif /* GC_DEBUG */ diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 030ba7b55b..701197269b 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -483,6 +483,8 @@ VALUE rb_gc_enable(void); VALUE rb_gc_disable(void); VALUE rb_gc_start(void); void rb_gc_set_params(void); +VALUE rb_define_finalizer(VALUE, VALUE); +VALUE rb_undefine_finalizer(VALUE); /* hash.c */ void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t); VALUE rb_check_hash_type(VALUE);