Skip to content

Commit

Permalink
* string.c (rb_str_equal): should return nil for non string
Browse files Browse the repository at this point in the history
  operand to conform comparable convention. [ruby-dev:20759]

* object.c (rb_equal): preserve nil if "==" returns nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jul 21, 2003
1 parent ced623c commit fa284f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Tue Jul 22 02:22:45 2003 Yukihiro Matsumoto <[email protected]>

* string.c (rb_str_equal): should return nil for non string
operand to conform comparable convention. [ruby-dev:20759]

* object.c (rb_equal): preserve nil if "==" returns nil.

Tue Jul 22 00:19:19 2003 Yukihiro Matsumoto <[email protected]>

* lib/tmpdir.rb: new library to get temporary directory path,
Expand Down
2 changes: 1 addition & 1 deletion object.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rb_equal(obj1, obj2)
if (obj1 == obj2) return Qtrue;
result = rb_funcall(obj1, id_eq, 1, obj2);
if (RTEST(result)) return Qtrue;
return Qfalse;
return result;
}

int
Expand Down
2 changes: 1 addition & 1 deletion string.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ rb_str_equal(str1, str2)
if (str1 == str2) return Qtrue;
if (TYPE(str2) != T_STRING) {
if (!rb_respond_to(str2, rb_intern("to_str"))) {
return Qfalse;
return Qnil;
}
return rb_equal(str2, str1);
}
Expand Down

0 comments on commit fa284f8

Please sign in to comment.