summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-18 02:51:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-18 14:53:51 +0900
commitce7942361d1f1f9a1ca958b6979a432da2014683 (patch)
tree6fc55794a67b3e6006833383cf8af550040c6167 /gc.c
parentc3b64a86bcd7773c081f5049115c57ec73d7a76a (diff)
Use identhash as WeakMap
As ObjectSpace::WeakMap allows FLONUM as a key, needs the special deal for its hash. [Feature #16035]
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 8900279d99..b95094b385 100644
--- a/gc.c
+++ b/gc.c
@@ -10493,13 +10493,15 @@ static const rb_data_type_t weakmap_type = {
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
};
+extern const struct st_hash_type rb_hashtype_ident;
+
static VALUE
wmap_allocate(VALUE klass)
{
struct weakmap *w;
VALUE obj = TypedData_Make_Struct(klass, struct weakmap, &weakmap_type, w);
- w->obj2wmap = st_init_numtable();
- w->wmap2obj = st_init_numtable();
+ w->obj2wmap = st_init_table(&rb_hashtype_ident);
+ w->wmap2obj = st_init_table(&rb_hashtype_ident);
w->final = rb_obj_method(obj, ID2SYM(rb_intern("finalize")));
return obj;
}