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

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
This commit is contained in:
nobu 2016-11-13 02:04:51 +00:00
parent 97803e2250
commit ffa371d9aa

View file

@ -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;
}
/*