summaryrefslogtreecommitdiff
path: root/weakmap.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-11-08 15:01:09 -0500
committerPeter Zhu <[email protected]>2024-11-11 13:38:40 -0500
commit8672e88cd2c983917c38f6c1c138b3de55607b96 (patch)
tree931134a754b273dc87647b21cc0529505b5e09e2 /weakmap.c
parent6a3eb384cebce1558ddda563bce61f39c494264f (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12037
Diffstat (limited to 'weakmap.c')
-rw-r--r--weakmap.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/weakmap.c b/weakmap.c
index a48179ab2c..32acf2d6ec 100644
--- a/weakmap.c
+++ b/weakmap.c
@@ -439,18 +439,6 @@ wmap_values(VALUE self)
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
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, val);
- return nonspecial_obj_id(val);
+ return Qnil;
}
/* Retrieves a weakly referenced object with the given key */