[前][次][番号順一覧][スレッド一覧]

ruby-changes:31552

From: nobu <ko1@a...>
Date: Sun, 10 Nov 2013 08:03:16 +0900 (JST)
Subject: [ruby-changes:31552] nobu:r43631 (trunk): gc.c: finalizer functions

nobu	2013-11-10 08:03:11 +0900 (Sun, 10 Nov 2013)

  New Revision: 43631

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43631

  Log:
    gc.c: finalizer functions
    
    * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
      finalizer functions.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/include/ruby/intern.h
Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 43630)
+++ include/ruby/intern.h	(revision 43631)
@@ -483,6 +483,8 @@ VALUE rb_gc_enable(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L483
 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);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43630)
+++ ChangeLog	(revision 43631)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov 10 08:03:05 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
+	  finalizer functions.
+
 Sun Nov 10 07:41:22 2013  Zachary Scott  <e@z...>
 
 	* lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439]
Index: gc.c
===================================================================
--- gc.c	(revision 43630)
+++ gc.c	(revision 43631)
@@ -625,8 +625,6 @@ void rb_gcdebug_print_obj_condition(VALU https://github.com/ruby/ruby/blob/trunk/gc.c#L625
 
 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L1847
 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) https://github.com/ruby/ruby/blob/trunk/gc.c#L1925
 }
 
 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L6004
     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) https://github.com/ruby/ruby/blob/trunk/gc.c#L6730
 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 */
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]