1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

encoding.c: encoding at inspect

* encoding.c (enc_inspect): use PRIsVALUE to preserve the result
  encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-07-14 17:21:36 +00:00
parent f2dc5f15ba
commit 2dc7d111f8
2 changed files with 8 additions and 6 deletions

View file

@ -1,4 +1,7 @@
Mon Jul 15 02:21:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Jul 15 02:21:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_inspect): use PRIsVALUE to preserve the result
encoding.
* encoding.c (enc_set_index): deal with terminator so that * encoding.c (enc_set_index): deal with terminator so that
rb_enc_set_index also works. rb_enc_set_index also works.

View file

@ -1023,11 +1023,10 @@ rb_enc_tolower(int c, rb_encoding *enc)
static VALUE static VALUE
enc_inspect(VALUE self) enc_inspect(VALUE self)
{ {
VALUE str = rb_sprintf("#<%s:%s%s>", rb_obj_classname(self), return rb_enc_sprintf(rb_usascii_encoding(),
rb_enc_name((rb_encoding*)DATA_PTR(self)), "#<%"PRIsVALUE":%s%s>", rb_obj_class(self),
(enc_dummy_p(self) ? " (dummy)" : "")); rb_enc_name((rb_encoding*)DATA_PTR(self)),
ENCODING_CODERANGE_SET(str, ENCINDEX_US_ASCII, ENC_CODERANGE_7BIT); (enc_dummy_p(self) ? " (dummy)" : ""));
return str;
} }
/* /*