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

ruby-changes:39434

From: nobu <ko1@a...>
Date: Mon, 10 Aug 2015 10:08:29 +0900 (JST)
Subject: [ruby-changes:39434] nobu:r51515 (trunk): objspace.c: use rb_ident_hash_new

nobu	2015-08-10 10:08:02 +0900 (Mon, 10 Aug 2015)

  New Revision: 51515

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

  Log:
    objspace.c: use rb_ident_hash_new
    
    * ext/objspace/objspace.c (reachable_objects_from_root): use
      rb_ident_hash_new instead of funcall Hash#compare_by_id.

  Modified files:
    trunk/ext/objspace/objspace.c
    trunk/internal.h
Index: ext/objspace/objspace.c
===================================================================
--- ext/objspace/objspace.c	(revision 51514)
+++ ext/objspace/objspace.c	(revision 51515)
@@ -744,8 +744,7 @@ reachable_object_from_root_i(const char https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L744
     else {
 	data->last_category = category;
 	category_str = data->last_category_str = rb_str_new2(category);
-	category_objects = data->last_category_objects = rb_hash_new();
-	rb_funcall(category_objects, rb_intern("compare_by_identity"), 0);
+	category_objects = data->last_category_objects = rb_ident_hash_new();
 	if (!NIL_P(rb_hash_lookup(data->categories, category_str))) {
 	    rb_bug("reachable_object_from_root_i: category should insert at once");
 	}
@@ -781,10 +780,9 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L780
 reachable_objects_from_root(VALUE self)
 {
     struct rofr_data data;
-    VALUE hash = data.categories = rb_hash_new();
+    VALUE hash = data.categories = rb_ident_hash_new();
     data.last_category = 0;
 
-    rb_funcall(hash, rb_intern("compare_by_identity"), 0);
     rb_objspace_reachable_objects_from_root(reachable_object_from_root_i, &data);
     rb_hash_foreach(hash, collect_values_of_values, hash);
 
Index: internal.h
===================================================================
--- internal.h	(revision 51514)
+++ internal.h	(revision 51515)
@@ -843,7 +843,6 @@ struct st_table *rb_hash_tbl_raw(VALUE h https://github.com/ruby/ruby/blob/trunk/internal.h#L843
 VALUE rb_hash_has_key(VALUE hash, VALUE key);
 VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
 long rb_objid_hash(st_index_t index);
-VALUE rb_ident_hash_new(void);
 st_table *rb_init_identtable(void);
 st_table *rb_init_identtable_with_size(st_index_t size);
 
@@ -1268,6 +1267,7 @@ VALUE rb_str_normalize_ospath(const char https://github.com/ruby/ruby/blob/trunk/internal.h#L1267
 
 /* hash.c (export) */
 VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
+VALUE rb_ident_hash_new(void);
 
 /* io.c (export) */
 void rb_maygvl_fd_fix_cloexec(int fd);

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

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