diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-13 02:04:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-13 02:04:51 +0000 |
commit | e2305b9b76f1ff8ee8dc7770e58fff8f0c7fdd9d (patch) | |
tree | 2ffe92dd533a24c47f09932db09bf75f4bbbba07 | |
parent | 99d8c77e18d7a8250e10d07a9e36c1db042babec (diff) | |
download | ruby-e2305b9b76f1ff8ee8dc7770e58fff8f0c7fdd9d.tar.gz |
numeric.c: limit return value
* numeric.c (num_equal): limit return value to true or false,
instead of the result of the other as-is.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | numeric.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1356,8 +1356,11 @@ num_cmp(VALUE x, VALUE y) static VALUE num_equal(VALUE x, VALUE y) { + VALUE result; if (x == y) return Qtrue; - return num_funcall1(y, id_eq, x); + result = num_funcall1(y, id_eq, x); + if (RTEST(result)) return Qtrue; + return Qfalse; } /* |