From 40db3d97ac03c8346fff14aa98340a68e79e85a5 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 19 Aug 2014 04:59:44 +0000 Subject: 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 --- compar.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'compar.c') diff --git a/compar.c b/compar.c index 893cde79fc..a38668edf1 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 -- cgit v1.2.1