From 13f20ccda7aeb82750b020d2c8bf4f8c6fc72d37 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 20 May 2008 19:21:26 +0000 Subject: [PATCH] * encoding.c (rb_ascii8bit_encoding): use ENCINDEX_ASCII. * encoding.c, include/ruby/encoding.h (rb_ascii8bit_encindex): added. * encoding.c (rb_locale_encoding): use rb_usascii_encoding(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ encoding.c | 10 ++++++++-- include/ruby/encoding.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index abaafbb315..6f2e814e0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed May 21 04:20:20 2008 NARUSE, Yui + + * encoding.c (rb_ascii8bit_encoding): use ENCINDEX_ASCII. + + * encoding.c, include/ruby/encoding.h (rb_ascii8bit_encindex): + added. + + * encoding.c (rb_locale_encoding): use rb_usascii_encoding(). + Wed May 21 01:45:58 2008 NAKAMURA Usaku * test/ruby/test_file_exhaustive.rb (setup): workaround for Windows diff --git a/encoding.c b/encoding.c index bb400e1ef0..e1824f557f 100644 --- a/encoding.c +++ b/encoding.c @@ -912,7 +912,13 @@ rb_ascii8bit_encoding(void) if (!enc_table.list) { rb_enc_init(); } - return enc_table.list[0].enc; + return enc_table.list[ENCINDEX_ASCII].enc; +} + +int +rb_ascii8bit_encindex(void) +{ + return ENCINDEX_ASCII; } rb_encoding * @@ -946,7 +952,7 @@ rb_locale_encoding(void) int idx; if (NIL_P(charmap)) - idx = rb_enc_find_index("US-ASCII"); + return rb_usascii_encoding(); else idx = rb_enc_find_index(StringValueCStr(charmap)); if (idx < 0) diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index e5820beb7c..ade293ec6f 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -171,6 +171,7 @@ rb_encoding *rb_usascii_encoding(void); rb_encoding *rb_locale_encoding(void); rb_encoding *rb_default_external_encoding(void); int rb_usascii_encindex(void); +int rb_ascii8bit_encindex(void); VALUE rb_enc_default_external(void); void rb_enc_set_default_external(VALUE encoding); VALUE rb_locale_charmap(VALUE klass);