1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Rename arguments for ObjectSpace::WeakMap#[]= for clarity

This commit is contained in:
Benoit Daloze 2020-05-02 16:13:57 +02:00
parent e964f67b89
commit c2dc52e18b

16
gc.c
View file

@ -10738,21 +10738,21 @@ wmap_aset_update(st_data_t *key, st_data_t *val, st_data_t arg, int existing)
/* Creates a weak reference from the given key to the given value */ /* Creates a weak reference from the given key to the given value */
static VALUE static VALUE
wmap_aset(VALUE self, VALUE wmap, VALUE orig) wmap_aset(VALUE self, VALUE key, VALUE value)
{ {
struct weakmap *w; struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w); TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
if (FL_ABLE(orig)) { if (FL_ABLE(value)) {
define_final0(orig, w->final); define_final0(value, w->final);
} }
if (FL_ABLE(wmap)) { if (FL_ABLE(key)) {
define_final0(wmap, w->final); define_final0(key, w->final);
} }
st_update(w->obj2wmap, (st_data_t)orig, wmap_aset_update, wmap); st_update(w->obj2wmap, (st_data_t)value, wmap_aset_update, key);
st_insert(w->wmap2obj, (st_data_t)wmap, (st_data_t)orig); st_insert(w->wmap2obj, (st_data_t)key, (st_data_t)value);
return nonspecial_obj_id(orig); return nonspecial_obj_id(value);
} }
/* Retrieves a weakly referenced object with the given key */ /* Retrieves a weakly referenced object with the given key */