mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
da90029db5
commit
24537e1b1c
3 changed files with 13 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Nov 10 08:03:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
|
||||
finalizer functions.
|
||||
|
||||
Sun Nov 10 07:41:22 2013 Zachary Scott <e@zzak.io>
|
||||
|
||||
* lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439]
|
||||
|
|
14
gc.c
14
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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue