diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-02 08:22:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-02 08:22:47 +0000 |
commit | 58919a4da91768367e4bb172df2ea4c9834c5eec (patch) | |
tree | 30809c94a6607c038383fe695aa4a757d1ef2291 | |
parent | 14dfdb5eaf2f4004fa0b08b0a1888e40e1ba5bc4 (diff) | |
download | ruby-58919a4da91768367e4bb172df2ea4c9834c5eec.tar.gz |
re.c: use built-in encoding indexes
* internal.h: add EUC-JP and Windows-31J.
* re.c (rb_char_to_option_kcode): use built-in encoding indexes in
internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | encoding.c | 3 | ||||
-rw-r--r-- | internal.h | 4 | ||||
-rw-r--r-- | re.c | 4 |
4 files changed, 15 insertions, 3 deletions
@@ -1,4 +1,9 @@ -Tue Jul 2 17:22:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> +Tue Jul 2 17:22:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * internal.h: add EUC-JP and Windows-31J. + + * re.c (rb_char_to_option_kcode): use built-in encoding indexes in + internal.h. * internal.h: add UTF8-MAC. diff --git a/encoding.c b/encoding.c index 5c399b1134..869c1b0acd 100644 --- a/encoding.c +++ b/encoding.c @@ -566,6 +566,9 @@ rb_enc_init(void) ENCDB_REGISTER("UTF-16", UTF_16); ENCDB_REGISTER("UTF-32", UTF_32); ENCDB_REGISTER("UTF8-MAC", UTF8_MAC); + + ENCDB_REGISTER("EUC-JP", EUC_JP); + ENCDB_REGISTER("Windows-31J", Windows_31J); #undef ENCDB_REGISTER #endif enc_table.count = ENCINDEX_BUILTIN_MAX; diff --git a/internal.h b/internal.h index 25e8220787..84ef95fe11 100644 --- a/internal.h +++ b/internal.h @@ -211,6 +211,10 @@ enum ruby_preserved_encindex { ENCINDEX_UTF_16, ENCINDEX_UTF_32, ENCINDEX_UTF8_MAC, + + /* for old options of regexp */ + ENCINDEX_EUC_JP, + ENCINDEX_Windows_31J, #endif ENCINDEX_BUILTIN_MAX @@ -307,10 +307,10 @@ rb_char_to_option_kcode(int c, int *option, int *kcode) *kcode = rb_ascii8bit_encindex(); return (*option = ARG_ENCODING_NONE); case 'e': - *kcode = rb_enc_find_index("EUC-JP"); + *kcode = ENCINDEX_EUC_JP; break; case 's': - *kcode = rb_enc_find_index("Windows-31J"); + *kcode = ENCINDEX_Windows_31J; break; case 'u': *kcode = rb_utf8_encindex(); |