mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* proc.c (method_name): preserve Symbol's encoding.
* numeric.c (fix_id2name): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a04a812ed0
commit
6ca558d6ab
8 changed files with 17 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Dec 25 01:38:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* proc.c (method_name): preserve Symbol's encoding.
|
||||||
|
|
||||||
|
* numeric.c (fix_id2name): ditto.
|
||||||
|
|
||||||
Tue Dec 25 01:19:18 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Dec 25 01:19:18 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
|
* include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
|
||||||
|
|
|
@ -4077,7 +4077,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
||||||
}
|
}
|
||||||
case NODE_DEFN:{
|
case NODE_DEFN:{
|
||||||
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
||||||
rb_str_new2(rb_id2name(node->nd_mid)),
|
rb_str_dup(rb_id2str(node->nd_mid)),
|
||||||
ISEQ_TYPE_METHOD);
|
ISEQ_TYPE_METHOD);
|
||||||
|
|
||||||
debugp_param("defn/iseq", iseqval);
|
debugp_param("defn/iseq", iseqval);
|
||||||
|
@ -4093,7 +4093,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
||||||
}
|
}
|
||||||
case NODE_DEFS:{
|
case NODE_DEFS:{
|
||||||
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
|
||||||
rb_str_new2(rb_id2name(node->nd_mid)),
|
rb_str_dup(rb_id2str(node->nd_mid)),
|
||||||
ISEQ_TYPE_METHOD);
|
ISEQ_TYPE_METHOD);
|
||||||
|
|
||||||
debugp_param("defs/iseq", iseqval);
|
debugp_param("defs/iseq", iseqval);
|
||||||
|
|
2
iseq.c
2
iseq.c
|
@ -665,7 +665,7 @@ insn_operand_intern(rb_iseq_t *iseq,
|
||||||
case TS_GENTRY:
|
case TS_GENTRY:
|
||||||
{
|
{
|
||||||
struct global_entry *entry = (struct global_entry *)op;
|
struct global_entry *entry = (struct global_entry *)op;
|
||||||
ret = rb_str_new2(rb_id2name(entry->id));
|
ret = rb_str_dup(rb_id2str(entry->id));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2809,8 +2809,8 @@ fix_abs(VALUE fix)
|
||||||
static VALUE
|
static VALUE
|
||||||
fix_id2name(VALUE fix)
|
fix_id2name(VALUE fix)
|
||||||
{
|
{
|
||||||
const char *name = rb_id2name(FIX2UINT(fix));
|
VALUE name = rb_id2str(FIX2UINT(fix));
|
||||||
if (name) return rb_str_new2(name);
|
if (name) return rb_str_dup(name);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
proc.c
2
proc.c
|
@ -858,7 +858,7 @@ method_name(VALUE obj)
|
||||||
struct METHOD *data;
|
struct METHOD *data;
|
||||||
|
|
||||||
Data_Get_Struct(obj, struct METHOD, data);
|
Data_Get_Struct(obj, struct METHOD, data);
|
||||||
return rb_str_new2(rb_id2name(data->id));
|
return rb_str_dup(rb_id2str(data->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
4
struct.c
4
struct.c
|
@ -498,7 +498,6 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
|
||||||
for (i=0; i<RSTRUCT_LEN(s); i++) {
|
for (i=0; i<RSTRUCT_LEN(s); i++) {
|
||||||
VALUE slot;
|
VALUE slot;
|
||||||
ID id;
|
ID id;
|
||||||
const char *p;
|
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
rb_str_cat2(str, ", ");
|
rb_str_cat2(str, ", ");
|
||||||
|
@ -506,8 +505,7 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
|
||||||
slot = RARRAY_PTR(members)[i];
|
slot = RARRAY_PTR(members)[i];
|
||||||
id = SYM2ID(slot);
|
id = SYM2ID(slot);
|
||||||
if (rb_is_local_id(id) || rb_is_const_id(id)) {
|
if (rb_is_local_id(id) || rb_is_const_id(id)) {
|
||||||
p = rb_id2name(id);
|
rb_str_append(str, rb_id2str(id));
|
||||||
rb_str_cat2(str, p);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_append(str, rb_inspect(slot));
|
rb_str_append(str, rb_inspect(slot));
|
||||||
|
|
|
@ -45,7 +45,7 @@ fc_path(struct fc_result *fc, ID name)
|
||||||
{
|
{
|
||||||
VALUE path, tmp;
|
VALUE path, tmp;
|
||||||
|
|
||||||
path = rb_str_new2(rb_id2name(name));
|
path = rb_str_dup(rb_id2str(name));
|
||||||
while (fc) {
|
while (fc) {
|
||||||
if (fc->track == rb_cObject) break;
|
if (fc->track == rb_cObject) break;
|
||||||
if (RCLASS_IV_TBL(fc->track) &&
|
if (RCLASS_IV_TBL(fc->track) &&
|
||||||
|
@ -56,7 +56,7 @@ fc_path(struct fc_result *fc, ID name)
|
||||||
path = tmp;
|
path = tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tmp = rb_str_new2(rb_id2name(fc->name));
|
tmp = rb_str_dup(rb_id2str(fc->name));
|
||||||
rb_str_cat2(tmp, "::");
|
rb_str_cat2(tmp, "::");
|
||||||
rb_str_append(tmp, path);
|
rb_str_append(tmp, path);
|
||||||
path = tmp;
|
path = tmp;
|
||||||
|
@ -148,7 +148,7 @@ classname(VALUE klass)
|
||||||
if (!st_lookup(RCLASS_IV_TBL(klass), classid, &path)) {
|
if (!st_lookup(RCLASS_IV_TBL(klass), classid, &path)) {
|
||||||
return find_class_path(klass);
|
return find_class_path(klass);
|
||||||
}
|
}
|
||||||
path = rb_str_new2(rb_id2name(SYM2ID(path)));
|
path = rb_str_dup(rb_id2str(SYM2ID(path)));
|
||||||
OBJ_FREEZE(path);
|
OBJ_FREEZE(path);
|
||||||
st_insert(RCLASS_IV_TBL(klass), classpath, path);
|
st_insert(RCLASS_IV_TBL(klass), classpath, path);
|
||||||
st_delete(RCLASS_IV_TBL(klass), (st_data_t*)&classid, 0);
|
st_delete(RCLASS_IV_TBL(klass), (st_data_t*)&classid, 0);
|
||||||
|
|
2
vm.c
2
vm.c
|
@ -286,7 +286,7 @@ collect_local_variables_in_env(rb_env_t *env, VALUE ary)
|
||||||
for (i = 0; i < env->block.iseq->local_table_size; i++) {
|
for (i = 0; i < env->block.iseq->local_table_size; i++) {
|
||||||
ID lid = env->block.iseq->local_table[i];
|
ID lid = env->block.iseq->local_table[i];
|
||||||
if (lid) {
|
if (lid) {
|
||||||
rb_ary_push(ary, rb_str_new2(rb_id2name(lid)));
|
rb_ary_push(ary, rb_str_dup(rb_id2str(lid)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (env->prev_envval) {
|
if (env->prev_envval) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue