summaryrefslogtreecommitdiff
path: root/compar.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-19 04:59:44 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-19 04:59:44 (GMT)
commit40db3d97ac03c8346fff14aa98340a68e79e85a5 (patch)
treeec5dc29aa65ce82e219fee4dc4ca117b0cf3a0b2 /compar.c
parentf9b7a2a33fa708ea220f26bd094a8b26c2da059c (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.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/compar.c b/compar.c
index 893cde7..a38668e 100644
--- a/compar.c
+++ b/compar.c
@@ -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