Make ObjectSpace::WeakMap#[]= return Qnil
Instead of returning some obscure value in ObjectSpace::WeakMap#[]= that's not even useful, we can just simply return Qnil.
This commit is contained in:
parent
6a3eb384ce
commit
8672e88cd2
Notes:
git
2024-11-11 18:38:56 +00:00
14
weakmap.c
14
weakmap.c
@ -439,18 +439,6 @@ wmap_values(VALUE self)
|
|||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
nonspecial_obj_id(VALUE obj)
|
|
||||||
{
|
|
||||||
#if SIZEOF_LONG == SIZEOF_VOIDP
|
|
||||||
return (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG);
|
|
||||||
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
|
|
||||||
return LL2NUM((SIGNED_VALUE)(obj) / 2);
|
|
||||||
#else
|
|
||||||
# error not supported
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wmap_aset_replace(st_data_t *key, st_data_t *val, st_data_t new_key_ptr, int existing)
|
wmap_aset_replace(st_data_t *key, st_data_t *val, st_data_t new_key_ptr, int existing)
|
||||||
{
|
{
|
||||||
@ -495,7 +483,7 @@ wmap_aset(VALUE self, VALUE key, VALUE val)
|
|||||||
RB_OBJ_WRITTEN(self, Qundef, key);
|
RB_OBJ_WRITTEN(self, Qundef, key);
|
||||||
RB_OBJ_WRITTEN(self, Qundef, val);
|
RB_OBJ_WRITTEN(self, Qundef, val);
|
||||||
|
|
||||||
return nonspecial_obj_id(val);
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieves a weakly referenced object with the given key */
|
/* Retrieves a weakly referenced object with the given key */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user