diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-11 02:51:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-11 02:51:46 +0000 |
commit | 84b5d04bed4598d63c41389655bd060a8caed798 (patch) | |
tree | 14b66dad3e177415d944fce2a14abab33e29d7ca | |
parent | 36eed7bdfbba432b220cc4e225f20dffcabc6e4f (diff) | |
download | ruby-84b5d04bed4598d63c41389655bd060a8caed798.tar.gz |
* encoding.c (rb_locale_encoding): removed Encoding::LOCALE.
* encoding.c (rb_enc_set_default_external): ditto.
* encoding.c (rb_enc_set_default_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | encoding.c | 17 |
2 files changed, 20 insertions, 5 deletions
@@ -1,3 +1,11 @@ +Thu Dec 11 11:51:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * encoding.c (rb_locale_encoding): removed Encoding::LOCALE. + + * encoding.c (rb_enc_set_default_external): ditto. + + * encoding.c (rb_enc_set_default_internal): ditto. + Thu Dec 11 11:11:03 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * include/ruby/st.h (size_t): needs stddef.h or stdlib.h. diff --git a/encoding.c b/encoding.c index 7b7d301133..d92a925aa0 100644 --- a/encoding.c +++ b/encoding.c @@ -349,11 +349,18 @@ enc_dummy_p(VALUE enc) return ENC_DUMMY_P(enc_table.list[must_encoding(enc)].enc) ? Qtrue : Qfalse; } -static int -enc_alias(const char *alias, int idx) +static const char * +enc_alias_internal(const char *alias, int idx) { alias = strdup(alias); st_insert(enc_table.names, (st_data_t)alias, (st_data_t)idx); + return alias; +} + +static int +enc_alias(const char *alias, int idx) +{ + alias = enc_alias_internal(alias, idx); set_encoding_const(alias, rb_enc_from_index(idx)); return idx; } @@ -1000,7 +1007,7 @@ rb_locale_encoding(void) else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0) idx = rb_ascii8bit_encindex(); - if (rb_enc_registered("locale") < 0) enc_alias("locale", idx); + if (rb_enc_registered("locale") < 0) enc_alias_internal("locale", idx); return rb_enc_from_index(idx); } @@ -1057,7 +1064,7 @@ rb_enc_set_default_external(VALUE encoding) { default_external_index = rb_enc_to_index(rb_to_encoding(encoding)); default_external = 0; - enc_alias("external", default_external_index); + enc_alias_internal("external", default_external_index); } /* -2 => not yet set, -1 => nil */ @@ -1112,7 +1119,7 @@ rb_enc_set_default_internal(VALUE encoding) if (default_internal_index == rb_usascii_encindex()) default_internal_index = rb_utf8_encindex(); default_internal = 0; - enc_alias("internal", default_internal_index); + enc_alias_internal("internal", default_internal_index); } /* |