diff options
author | 卜部昌平 <[email protected]> | 2020-08-17 11:12:23 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-08-19 15:10:53 +0900 |
commit | 99093e1600ccef17ab99356b689573fcfd336ecc () | |
tree | b0654845b92b038889fff4eab6e1c73b6ba8a4c0 | |
parent | d2eeb836344406eff3342b86436cc7eb0f8cc908 (diff) |
RHASH_TBL: is now ext-only
It seems almost no internal codes use RHASH_TBL any longer. Why not just eliminate it entirely, so that the macro can be purely ext-only.
Notes: Merged: https://.com/ruby/ruby/pull/3426
-rw-r--r-- | ext/coverage/coverage.c | 3 | ||||
-rw-r--r-- | ext/objspace/objspace.c | 3 | ||||
-rw-r--r-- | hash.c | 9 | ||||
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | internal/hash.h | 5 | ||||
-rw-r--r-- | struct.c | 6 |
6 files changed, 10 insertions, 17 deletions
@@ -252,7 +252,8 @@ rb_coverage_peek_result(VALUE klass) if (!RTEST(coverages)) { rb_raise(rb_eRuntimeError, "coverage measurement is not enabled"); } - st_foreach(RHASH_TBL(coverages), coverage_peek_result_i, ncoverages); if (current_mode & COVERAGE_TARGET_METHODS) { rb_objspace_each_objects(method_coverage_i, &ncoverages); @@ -141,7 +141,8 @@ setup_hash(int argc, VALUE *argv) hash = rb_hash_new(); } else if (!RHASH_EMPTY_P(hash)) { - st_foreach(RHASH_TBL(hash), set_zero_i, hash); } return hash; @@ -1620,23 +1620,16 @@ rb_hash_modify_check(VALUE hash) } MJIT_FUNC_EXPORTED struct st_table * -#if RHASH_CONVERT_TABLE_DEBUG rb_hash_tbl_raw(VALUE hash, const char *file, int line) { return ar_force_convert_table(hash, file, line); } -#else -rb_hash_tbl_raw(VALUE hash) -{ - return ar_force_convert_table(hash, NULL, 0); -} -#endif struct st_table * rb_hash_tbl(VALUE hash, const char *file, int line) { OBJ_WB_UNPROTECT(hash); - return RHASH_TBL_RAW(hash); } static void @@ -46,6 +46,7 @@ /* internal/hash.h */ #undef RHASH_IFNONE #undef RHASH_SIZE /* internal/object.h */ #undef ROBJECT_IV_INDEX_TBL @@ -107,13 +107,8 @@ VALUE rb_hash_keys(VALUE hash); VALUE rb_hash_has_key(VALUE hash, VALUE key); VALUE rb_hash_compare_by_id_p(VALUE hash); -#if RHASH_CONVERT_TABLE_DEBUG st_table *rb_hash_tbl_raw(VALUE hash, const char *file, int line); #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h, __FILE__, __LINE__) -#else -st_table *rb_hash_tbl_raw(VALUE hash); -#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h) -#endif MJIT_SYMBOL_EXPORT_END #if 0 /* for debug */ @@ -388,9 +388,10 @@ struct_make_members_list(va_list ar) { char *mem; VALUE ary, list = rb_ident_hash_new(); - st_table *tbl = RHASH_TBL(list); RBASIC_CLEAR_CLASS(list); while ((mem = va_arg(ar, char*)) != 0) { VALUE sym = rb_sym_intern_ascii_cstr(mem); if (st_insert(tbl, sym, Qtrue)) { @@ -583,7 +584,8 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass) rest = rb_ident_hash_new(); RBASIC_CLEAR_CLASS(rest); - tbl = RHASH_TBL(rest); for (i=0; i<argc; i++) { VALUE mem = rb_to_symbol(argv[i]); if (rb_is_attrset_sym(mem)) { |