summaryrefslogtreecommitdiffstats
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
commit056541ea68ca90046eb625457b3af38f3e2dfe23 (patch)
tree97097f47433ce9a3137c4f80bcacd411ae7a0ea8 /encoding.c
parent7759aea643bf7b94f0ff1f0c2717305e6a73c209 (diff)
downloadruby-056541ea68ca90046eb625457b3af38f3e2dfe23.tar.gz
ruby-056541ea68ca90046eb625457b3af38f3e2dfe23.tar.xz
ruby-056541ea68ca90046eb625457b3af38f3e2dfe23.zip
* encoding.c (rb_enc_aliases): don't see enc_table_alias when it wasn't initialized yet.
git-svn-id: http://svn.ruby-lang.org/repos/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 b9e69617e..c62e32b3d 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;
}