summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/thread.c b/thread.c
index 4fabf8921c..602e7a3294 100644
--- a/thread.c
+++ b/thread.c
@@ -4599,7 +4599,7 @@ recursive_list_access(void)
}
/*
- * Returns Qtrue iff obj_id (or the pair <obj, paired_obj>) is already
+ * Returns Qtrue if obj_id (or the pair <obj, paired_obj>) is already
* in the recursion list.
* Assumes the recursion list is valid.
*/
@@ -4607,17 +4607,24 @@ recursive_list_access(void)
static VALUE
recursive_check(VALUE list, VALUE obj_id, VALUE paired_obj_id)
{
+#if SIZEOF_LONG == SIZEOF_VOIDP
+ #define OBJ_ID_EQL(obj_id, other) ((obj_id) == (other))
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+ #define OBJ_ID_EQL(obj_id, other) (RB_TYPE_P((obj_id), T_BIGNUM) ? \
+ rb_big_eql((obj_id), (other)) : ((obj_id) == (other)))
+#endif
+
VALUE pair_list = rb_hash_lookup2(list, obj_id, Qundef);
if (pair_list == Qundef)
return Qfalse;
if (paired_obj_id) {
if (!RB_TYPE_P(pair_list, T_HASH)) {
- if (pair_list != paired_obj_id)
- return Qfalse;
+ if (!OBJ_ID_EQL(paired_obj_id, pair_list))
+ return Qfalse;
}
else {
- if (NIL_P(rb_hash_lookup(pair_list, paired_obj_id)))
- return Qfalse;
+ if (NIL_P(rb_hash_lookup(pair_list, paired_obj_id)))
+ return Qfalse;
}
}
return Qtrue;