From 62d43632ba902d4b52991665bdedb4cdd2b21332 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Dec 2014 06:36:05 +0000 Subject: 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 --- ChangeLog | 5 +++++ hash.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10ab61c555..f132b5af2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 19 15:36:02 2014 Simon Genier + + * 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 * configure.in (rb_cv_binary_elf): get rid of -e option of cat diff --git a/hash.c b/hash.c index a0c1ced09b..1b9b5a2e49 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; -- cgit v1.2.3