* 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:
parent
05124e6a55
commit
017ff9bfa2
@ -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>
|
Fri Oct 10 00:21:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/optparse.rb (ParseError.filter_backtrace): removes internal
|
* lib/optparse.rb (ParseError.filter_backtrace): removes internal
|
||||||
|
19
encoding.c
19
encoding.c
@ -824,12 +824,14 @@ enc_name(VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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);
|
VALUE str = rb_usascii_str_new2((char *)name);
|
||||||
OBJ_FREEZE(str);
|
OBJ_FREEZE(str);
|
||||||
rb_ary_push(ary, str);
|
rb_ary_push(arg[1], str);
|
||||||
}
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
@ -845,11 +847,12 @@ enc_names_i(st_data_t name, st_data_t idx, st_data_t ary)
|
|||||||
static VALUE
|
static VALUE
|
||||||
enc_names(VALUE self)
|
enc_names(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE ary = rb_ary_new2(0);
|
VALUE args[2];
|
||||||
rb_ary_push(ary, INT2FIX(rb_to_encoding_index(self)));
|
|
||||||
st_foreach(enc_table.names, enc_names_i, (st_data_t)ary);
|
args[0] = (VALUE)rb_to_encoding_index(self);
|
||||||
rb_ary_shift(ary);
|
args[1] = rb_ary_new2(0);
|
||||||
return ary;
|
st_foreach(enc_table.names, enc_names_i, (st_data_t)args);
|
||||||
|
return args[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user