diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-19 06:36:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-19 06:36:05 +0000 |
commit | 62d43632ba902d4b52991665bdedb4cdd2b21332 (patch) | |
tree | f94203026984334169fc154796224777193c2eb2 /hash.c | |
parent | 7ce07a85fe5720fae32b767db5c89f854f962aae (diff) | |
download | ruby-62d43632ba902d4b52991665bdedb4cdd2b21332.tar.gz |
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.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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; |