1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-12-19 06:36:05 +00:00
parent 7ce07a85fe
commit 62d43632ba
2 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 19 15:36:02 2014 Simon Genier <simon.genier@shopify.com>
* hash.c (hash_equal): prefer true than the result of implicit
conversion from int returned by rb_eql() to VALUE. [Fix GH-789]
Thu Dec 18 17:45:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (rb_cv_binary_elf): get rid of -e option of cat

13
hash.c
View file

@ -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;