aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-13 02:04:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-13 02:04:51 +0000
commite2305b9b76f1ff8ee8dc7770e58fff8f0c7fdd9d (patch)
tree2ffe92dd533a24c47f09932db09bf75f4bbbba07
parent99d8c77e18d7a8250e10d07a9e36c1db042babec (diff)
downloadruby-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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 1bb939c333..959626e28d 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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;
}
/*