Skip to content

Commit

Permalink
object.c: rb_eql returns int not VALUE
Browse files Browse the repository at this point in the history
It works, but assumes `Qfalse == 0`, which is true today
but might not be forever.
  • Loading branch information
byroot committed Oct 10, 2022
1 parent f1c89c8 commit 1a7e7bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/ruby/internal/intern/object.h
Expand Up @@ -92,8 +92,8 @@ VALUE rb_class_new_instance_kw(int argc, const VALUE *argv, VALUE klass, int kw_
*
* @param[in] lhs Comparison left hand side.
* @param[in] rhs Comparison right hand side.
* @retval RUBY_Qtrue They are equal.
* @retval RUBY_Qfalse Otherwise.
* @retval non-zero They are equal.
* @retval 0 Otherwise.
* @note This function actually calls `lhs.eql?(rhs)` so you cannot
* implement your class' `#eql?` method using it.
*/
Expand Down
4 changes: 2 additions & 2 deletions object.c
Expand Up @@ -134,12 +134,12 @@ rb_eql(VALUE obj1, VALUE obj2)
{
VALUE result;

if (obj1 == obj2) return Qtrue;
if (obj1 == obj2) return TRUE;
result = rb_eql_opt(obj1, obj2);
if (result == Qundef) {
result = rb_funcall(obj1, id_eql, 1, obj2);
}
return RBOOL(RTEST(result));
return RTEST(result);
}

/**
Expand Down

0 comments on commit 1a7e7bb

Please sign in to comment.