[前][次][番号順一覧][スレッド一覧]

ruby-changes:3128

From: ko1@a...
Date: 25 Dec 2007 01:39:04 +0900
Subject: [ruby-changes:3128] matz - Ruby:r14620 (trunk): * proc.c (method_name): preserve Symbol's encoding.

matz	2007-12-25 01:38:44 +0900 (Tue, 25 Dec 2007)

  New Revision: 14620

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/iseq.c
    trunk/numeric.c
    trunk/proc.c
    trunk/struct.c
    trunk/variable.c
    trunk/vm.c

  Log:
    * proc.c (method_name): preserve Symbol's encoding.
    
    * numeric.c (fix_id2name): ditto.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/numeric.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/variable.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/struct.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/proc.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/iseq.c?r1=14620&r2=14619
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=14620&r2=14619

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14619)
+++ ChangeLog	(revision 14620)
@@ -1,3 +1,9 @@
+Tue Dec 25 01:38:04 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* proc.c (method_name): preserve Symbol's encoding.
+
+	* numeric.c (fix_id2name): ditto.
+
 Tue Dec 25 01:19:18 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
Index: variable.c
===================================================================
--- variable.c	(revision 14619)
+++ variable.c	(revision 14620)
@@ -45,7 +45,7 @@
 {
     VALUE path, tmp;
 
-    path = rb_str_new2(rb_id2name(name));
+    path = rb_str_dup(rb_id2str(name));
     while (fc) {
 	if (fc->track == rb_cObject) break;
 	if (RCLASS_IV_TBL(fc->track) &&
@@ -56,7 +56,7 @@
 	    path = tmp;
 	    break;
 	}
-	tmp = rb_str_new2(rb_id2name(fc->name));
+	tmp = rb_str_dup(rb_id2str(fc->name));
 	rb_str_cat2(tmp, "::");
 	rb_str_append(tmp, path);
 	path = tmp;
@@ -148,7 +148,7 @@
 	    if (!st_lookup(RCLASS_IV_TBL(klass), classid, &path)) {
 		return find_class_path(klass);
 	    }
-	    path = rb_str_new2(rb_id2name(SYM2ID(path)));
+	    path = rb_str_dup(rb_id2str(SYM2ID(path)));
 	    OBJ_FREEZE(path);
 	    st_insert(RCLASS_IV_TBL(klass), classpath, path);
 	    st_delete(RCLASS_IV_TBL(klass), (st_data_t*)&classid, 0);
Index: iseq.c
===================================================================
--- iseq.c	(revision 14619)
+++ iseq.c	(revision 14620)
@@ -665,7 +665,7 @@
       case TS_GENTRY:
 	{
 	    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;
 
Index: compile.c
===================================================================
--- compile.c	(revision 14619)
+++ compile.c	(revision 14620)
@@ -4077,7 +4077,7 @@
       }
       case NODE_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);
 
 	debugp_param("defn/iseq", iseqval);
@@ -4093,7 +4093,7 @@
       }
       case NODE_DEFS:{
 	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);
 
 	debugp_param("defs/iseq", iseqval);
Index: proc.c
===================================================================
--- proc.c	(revision 14619)
+++ proc.c	(revision 14620)
@@ -858,7 +858,7 @@
     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));
 }
 
 /*
Index: struct.c
===================================================================
--- struct.c	(revision 14619)
+++ struct.c	(revision 14620)
@@ -498,7 +498,6 @@
     for (i=0; i<RSTRUCT_LEN(s); i++) {
 	VALUE slot;
 	ID id;
-	const char *p;
 
 	if (i > 0) {
 	    rb_str_cat2(str, ", ");
@@ -506,8 +505,7 @@
 	slot = RARRAY_PTR(members)[i];
 	id = SYM2ID(slot);
 	if (rb_is_local_id(id) || rb_is_const_id(id)) {
-	    p = rb_id2name(id);
-	    rb_str_cat2(str, p);
+	    rb_str_append(str, rb_id2str(id));
 	}
 	else {
 	    rb_str_append(str, rb_inspect(slot));
Index: numeric.c
===================================================================
--- numeric.c	(revision 14619)
+++ numeric.c	(revision 14620)
@@ -2809,8 +2809,8 @@
 static VALUE
 fix_id2name(VALUE fix)
 {
-    const char *name = rb_id2name(FIX2UINT(fix));
-    if (name) return rb_str_new2(name);
+    VALUE name = rb_id2str(FIX2UINT(fix));
+    if (name) return rb_str_dup(name);
     return Qnil;
 }
 
Index: vm.c
===================================================================
--- vm.c	(revision 14619)
+++ vm.c	(revision 14620)
@@ -286,7 +286,7 @@
     for (i = 0; i < env->block.iseq->local_table_size; i++) {
 	ID lid = env->block.iseq->local_table[i];
 	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) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]