summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-19 06:36:05 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-19 06:36:05 (GMT)
commit62d43632ba902d4b52991665bdedb4cdd2b21332 (patch)
treef94203026984334169fc154796224777193c2eb2 /hash.c
parent7ce07a85fe5720fae32b767db5c89f854f962aae (diff)
hash.c: fix return value
* hash.c (hash_equal): prefer true than the result of implicit conversion from int returned by rb_eql() to VALUE. [Fix GH-789] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index a0c1ced..1b9b5a2 100644
--- a/hash.c
+++ b/hash.c
@@ -1944,10 +1944,17 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
if (!rb_respond_to(hash2, idTo_hash)) {
return Qfalse;
}
- if (eql)
- return rb_eql(hash2, hash1);
- else
+ if (eql) {
+ if (rb_eql(hash2, hash1)) {
+ return Qtrue;
+ }
+ else {
+ return Qfalse;
+ }
+ }
+ else {
return rb_equal(hash2, hash1);
+ }
}
if (RHASH_SIZE(hash1) != RHASH_SIZE(hash2))
return Qfalse;