summaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-07 06:04:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-07 06:04:03 +0000
commit4a03ee8505a359e75fffe3b60923c3ef7f014d4e (patch)
tree8517829a2d01e495bbf3da07ab1e08c51b3355b2 /thread.c
parent6b505e88cfd99b1545007632814fe86a77794309 (diff)
downloadruby-4a03ee8505a359e75fffe3b60923c3ef7f014d4e.tar.gz
ruby-4a03ee8505a359e75fffe3b60923c3ef7f014d4e.tar.xz
ruby-4a03ee8505a359e75fffe3b60923c3ef7f014d4e.zip
* thread.c (recursive_pop): use object ID.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/thread.c b/thread.c
index b6b827f9b..94d2ae5f4 100644
--- a/thread.c
+++ b/thread.c
@@ -2593,7 +2593,7 @@ recursive_check(VALUE hash, VALUE obj)
if (NIL_P(list) || TYPE(list) != T_HASH)
return Qfalse;
- if (NIL_P(rb_hash_lookup(list, rb_obj_id(obj))))
+ if (NIL_P(rb_hash_lookup(list, obj)))
return Qfalse;
return Qtrue;
}
@@ -2617,7 +2617,7 @@ recursive_push(VALUE hash, VALUE obj)
list = rb_hash_new();
rb_hash_aset(hash, sym, list);
}
- rb_hash_aset(list, rb_obj_id(obj), Qtrue);
+ rb_hash_aset(list, obj, Qtrue);
return hash;
}
@@ -2650,21 +2650,22 @@ VALUE
rb_exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE arg)
{
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
+ VALUE objid = rb_obj_id(obj);
- if (recursive_check(hash, obj)) {
+ if (recursive_check(hash, objid)) {
return (*func) (obj, arg, Qtrue);
}
else {
VALUE result = Qundef;
int state;
- hash = recursive_push(hash, obj);
+ hash = recursive_push(hash, objid);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*func) (obj, arg, Qfalse);
}
POP_TAG();
- recursive_pop(hash, obj);
+ recursive_pop(hash, objid);
if (state)
JUMP_TAG(state);
return result;