summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-08-17 11:12:23 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-08-19 15:10:53 +0900
commit99093e1600ccef17ab99356b689573fcfd336ecc (patch)
treeb0654845b92b038889fff4eab6e1c73b6ba8a4c0 /ext
parentd2eeb836344406eff3342b86436cc7eb0f8cc908 (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
Notes: Merged: https://github.com/ruby/ruby/pull/3426
Diffstat (limited to 'ext')
-rw-r--r--ext/coverage/coverage.c3
-rw-r--r--ext/objspace/objspace.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index 49f7ffa0f8..5b29ea2aea 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -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);
+ OBJ_WB_UNPROTECT(coverages);
+ st_foreach(RHASH_TBL_RAW(coverages), coverage_peek_result_i, ncoverages);
if (current_mode & COVERAGE_TARGET_METHODS) {
rb_objspace_each_objects(method_coverage_i, &ncoverages);
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index a9b1e64183..262640d30c 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -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);
+ /* WB: no new reference */
+ st_foreach(RHASH_TBL_RAW(hash), set_zero_i, hash);
}
return hash;