ruby-changes:32758
From: nobu <ko1@a...>
Date: Wed, 5 Feb 2014 17:24:46 +0900 (JST)
Subject: [ruby-changes:32758] nobu:r44837 (trunk): marshal.c: preserve encoding
nobu 2014-02-05 17:24:37 +0900 (Wed, 05 Feb 2014) New Revision: 44837 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44837 Log: marshal.c: preserve encoding * marshal.c (must_not_be_anonymous, class2path): preserve encoding in the exception messages. Modified files: trunk/marshal.c Index: marshal.c =================================================================== --- marshal.c (revision 44836) +++ marshal.c (revision 44837) @@ -189,31 +189,31 @@ static const rb_data_type_t dump_arg_dat https://github.com/ruby/ruby/blob/trunk/marshal.c#L189 NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY }; -static const char * +static VALUE must_not_be_anonymous(const char *type, VALUE path) { char *n = RSTRING_PTR(path); if (!rb_enc_asciicompat(rb_enc_get(path))) { /* cannot occur? */ - rb_raise(rb_eTypeError, "can't dump non-ascii %s name", type); + rb_raise(rb_eTypeError, "can't dump non-ascii %s name % "PRIsVALUE, + type, path); } if (n[0] == '#') { - rb_raise(rb_eTypeError, "can't dump anonymous %s %.*s", type, - (int)RSTRING_LEN(path), n); + rb_raise(rb_eTypeError, "can't dump anonymous %s % "PRIsVALUE, + type, path); } - return n; + return path; } static VALUE class2path(VALUE klass) { VALUE path = rb_class_path(klass); - const char *n; - n = must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path); + must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path); if (rb_path_to_class(path) != rb_class_real(klass)) { - rb_raise(rb_eTypeError, "%s can't be referred to", n); + rb_raise(rb_eTypeError, "% "PRIsVALUE" can't be referred to", path); } return path; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/