summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-18 14:31:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-18 14:31:15 +0000
commit256e8b9afc71ebd966396e570727634ba6163000 (patch)
tree5011de2d2275b60cb0a4c902e5a7939f0c35aae5 /proc.c
parente606e7e32b5b427d3d694123670e27fb9b58b171 (diff)
* proc.c (proc_eq): equivalence check should not done by pointer
comparison, but should be based on iseq contents. [ruby-dev:37101] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/proc.c b/proc.c
index 4907d80bbb..b383d85d8e 100644
--- a/proc.c
+++ b/proc.c
@@ -666,12 +666,15 @@ proc_eq(VALUE self, VALUE other)
}
else {
if (TYPE(other) == T_DATA &&
- RBASIC(other)->klass == rb_cProc &&
- CLASS_OF(self) == CLASS_OF(other)) {
+ RDATA(other)->dmark == proc_mark) {
rb_proc_t *p1, *p2;
GetProcPtr(self, p1);
GetProcPtr(other, p2);
- if (p1->block.iseq == p2->block.iseq && p1->envval == p2->envval) {
+ if (p1->envval == p2->envval &&
+ p1->block.iseq->iseq_size == p2->block.iseq->iseq_size &&
+ p1->block.iseq->local_size == p2->block.iseq->local_size &&
+ MEMCMP(p1->block.iseq->iseq, p2->block.iseq->iseq, VALUE,
+ p1->block.iseq->iseq_size) == 0) {
return Qtrue;
}
}