summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 09:41:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 09:41:50 +0000
commitbb8ddbe8471d4d1a66b79956b7697f947fb0a61d (patch)
tree31174f6d592d63136fcc1ba21950aa28c645d0ed /encoding.c
parente26e05c4abf76d751bd17704b55ab550a9fe024e (diff)
* encoding.c (Init_Encoding): moved initialization from encdb.h.
* enc/make_encdb.rb (enc_name_list): constified. * enc/make_encdb.rb (enc_init_db): moved some functions to encoding.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c
index 62a4c87e22..9abfe2a833 100644
--- a/encoding.c
+++ b/encoding.c
@@ -34,6 +34,12 @@ static struct {
st_table *alias_name;
} enc_table;
+#undef ENC_REPLICATE
+#undef ENC_ALIAS
+#define ENC_REPLICATE(name, orig) st_insert(enc_table.replica_name, (st_data_t)(name), (st_data_t)(orig))
+#define ENC_ALIAS(name, orig) st_insert(enc_table.alias_name, (st_data_t)(name), (st_data_t)(orig))
+#define enc_name_list_size (sizeof(enc_name_list)/sizeof(enc_name_list[0]))
+
#include "encdb.h"
#define ENC_UNINITIALIZED (&rb_cEncoding)
@@ -1033,6 +1039,9 @@ Init_Encoding(void)
{
id_base_encoding = rb_intern("#base_encoding");
+ enc_table.replica_name = st_init_strcasetable();
+ enc_table.alias_name = st_init_strcasetable();
+
rb_cEncoding = rb_define_class("Encoding", rb_cObject);
rb_undef_alloc_func(rb_cEncoding);
rb_define_method(rb_cEncoding, "to_s", enc_name, 0);