summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-12 16:34:08 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-12 16:34:08 +0000
commit4261dd6ab742eea969df5da3e2ce94a75759efe2 (patch)
tree97097f47433ce9a3137c4f80bcacd411ae7a0ea8 /encoding.c
parent5b9739a832c884f450e04d90edb026a09da5e6de (diff)
* encoding.c (rb_enc_aliases): don't see enc_table_alias when it wasn't initialized yet.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c
index b9e69617ea..c62e32b3d7 100644
--- a/encoding.c
+++ b/encoding.c
@@ -999,7 +999,7 @@ rb_enc_name_list(VALUE klass)
static int
rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg)
{
- rb_hash_aset((VALUE)arg, rb_str_new2((char *)name), rb_enc_name(rb_enc_from_index((int)orig)));
+ rb_hash_aset((VALUE)arg, rb_str_new2((char *)name), rb_str_new2(rb_enc_name(rb_enc_from_index((int)orig))));
return 0;
}
@@ -1014,7 +1014,7 @@ static VALUE
rb_enc_aliases(VALUE klass)
{
VALUE aliases = rb_hash_new();
- st_foreach(enc_table_alias, rb_enc_aliases_enc_i, (st_data_t)aliases);
+ if (enc_table_alias) st_foreach(enc_table_alias, rb_enc_aliases_enc_i, (st_data_t)aliases);
st_foreach(enc_table_alias_name, rb_enc_aliases_str_i, (st_data_t)aliases);
return aliases;
}