1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (enc_names): minor improvement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-10-09 16:55:51 +00:00
parent 05124e6a55
commit 017ff9bfa2
2 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,7 @@
Fri Oct 10 01:55:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_names): minor improvement.
Fri Oct 10 00:21:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (ParseError.filter_backtrace): removes internal

View file

@ -824,12 +824,14 @@ enc_name(VALUE self)
}
static int
enc_names_i(st_data_t name, st_data_t idx, st_data_t ary)
enc_names_i(st_data_t name, st_data_t idx, st_data_t args)
{
if ((int)idx == FIX2INT(rb_ary_entry(ary, 0))) {
VALUE *arg = (VALUE *)args;
if ((int)idx == (int)arg[0]) {
VALUE str = rb_usascii_str_new2((char *)name);
OBJ_FREEZE(str);
rb_ary_push(ary, str);
rb_ary_push(arg[1], str);
}
return ST_CONTINUE;
}
@ -845,11 +847,12 @@ enc_names_i(st_data_t name, st_data_t idx, st_data_t ary)
static VALUE
enc_names(VALUE self)
{
VALUE ary = rb_ary_new2(0);
rb_ary_push(ary, INT2FIX(rb_to_encoding_index(self)));
st_foreach(enc_table.names, enc_names_i, (st_data_t)ary);
rb_ary_shift(ary);
return ary;
VALUE args[2];
args[0] = (VALUE)rb_to_encoding_index(self);
args[1] = rb_ary_new2(0);
st_foreach(enc_table.names, enc_names_i, (st_data_t)args);
return args[1];
}
/*