diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-19 04:59:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-19 04:59:44 +0000 |
commit | 40db3d97ac03c8346fff14aa98340a68e79e85a5 (patch) | |
tree | ec5dc29aa65ce82e219fee4dc4ca117b0cf3a0b2 /compar.c | |
parent | f9b7a2a33fa708ea220f26bd094a8b26c2da059c (diff) |
compar.c: preserve encodings
* compar.c (rb_cmperr): preserve encodings of arguments in the
message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compar.c')
-rw-r--r-- | compar.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -18,17 +18,16 @@ static ID cmp; void rb_cmperr(VALUE x, VALUE y) { - const char *classname; + VALUE classname; if (SPECIAL_CONST_P(y)) { - y = rb_inspect(y); - classname = StringValuePtr(y); + classname = rb_inspect(y); } else { - classname = rb_obj_classname(y); + classname = rb_class_path(rb_obj_class(y)); } - rb_raise(rb_eArgError, "comparison of %s with %s failed", - rb_obj_classname(x), classname); + rb_raise(rb_eArgError, "comparison of %"PRIsVALUE" with %"PRIsVALUE" failed", + rb_class_path(rb_obj_class(x)), classname); } static VALUE |