From bdddaa9f56702e1d3a58a14607e9881052424b53 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 3 Jul 2019 02:09:01 +0900 Subject: [PATCH] Use rb_ident_hash_new instead of rb_hash_new_compare_by_id The latter is same as the former, removed the duplicate function. --- ext/coverage/coverage.c | 2 +- hash.c | 8 -------- internal.h | 3 --- variable.c | 2 +- vm_eval.c | 2 +- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index c7f5a5e34b..05026e1ba2 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -54,7 +54,7 @@ rb_coverage_start(int argc, VALUE *argv, VALUE klass) } if (mode & COVERAGE_TARGET_METHODS) { - me2counter = rb_hash_new_compare_by_id(); + me2counter = rb_ident_hash_new(); } else { me2counter = Qnil; diff --git a/hash.c b/hash.c index be4fc216d4..df77e898a1 100644 --- a/hash.c +++ b/hash.c @@ -1364,14 +1364,6 @@ rb_hash_new(void) return hash_alloc(rb_cHash); } -VALUE -rb_hash_new_compare_by_id(void) -{ - VALUE hash = rb_hash_new(); - RHASH_ST_TABLE_SET(hash, rb_init_identtable()); - return hash; -} - MJIT_FUNC_EXPORTED VALUE rb_hash_new_with_size(st_index_t size) { diff --git a/internal.h b/internal.h index c84461792f..f2c9e9a814 100644 --- a/internal.h +++ b/internal.h @@ -1605,9 +1605,6 @@ struct st_table *rb_hash_tbl_raw(VALUE hash); #endif VALUE rb_hash_new_with_size(st_index_t size); -RUBY_SYMBOL_EXPORT_BEGIN -VALUE rb_hash_new_compare_by_id(void); -RUBY_SYMBOL_EXPORT_END VALUE rb_hash_has_key(VALUE hash, VALUE key); VALUE rb_hash_default_value(VALUE hash, VALUE key); VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc); diff --git a/variable.c b/variable.c index 476701d060..7d6905f390 100644 --- a/variable.c +++ b/variable.c @@ -2020,7 +2020,7 @@ rb_autoload_str(VALUE mod, ID id, VALUE file) } file = rb_fstring(file); if (!autoload_featuremap) { - autoload_featuremap = rb_hash_new_compare_by_id(); + autoload_featuremap = rb_ident_hash_new(); rb_obj_hide(autoload_featuremap); rb_gc_register_mark_object(autoload_featuremap); } diff --git a/vm_eval.c b/vm_eval.c index be645ec818..068944d0b5 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -2028,7 +2028,7 @@ rb_catch_obj(VALUE t, VALUE (*func)(), VALUE data) static void local_var_list_init(struct local_var_list *vars) { - vars->tbl = rb_hash_new_compare_by_id(); + vars->tbl = rb_ident_hash_new(); RBASIC_CLEAR_CLASS(vars->tbl); }