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

ruby-changes:31997

From: nobu <ko1@a...>
Date: Sun, 8 Dec 2013 20:38:40 +0900 (JST)
Subject: [ruby-changes:31997] nobu:r44076 (trunk): variable.c: frozen class name

nobu	2013-12-08 20:38:34 +0900 (Sun, 08 Dec 2013)

  New Revision: 44076

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44076

  Log:
    variable.c: frozen class name
    
    * variable.c (fc_path, classname): return ID strings without
      unnecessary copying.

  Modified files:
    trunk/variable.c
Index: variable.c
===================================================================
--- variable.c	(revision 44075)
+++ variable.c	(revision 44076)
@@ -49,7 +49,7 @@ fc_path(struct fc_result *fc, ID name) https://github.com/ruby/ruby/blob/trunk/variable.c#L49
 {
     VALUE path, tmp;
 
-    path = rb_str_dup(rb_id2str(name));
+    path = rb_id2str(name);
     while (fc) {
 	st_data_t n;
 	if (fc->track == rb_cObject) break;
@@ -176,8 +176,7 @@ classname(VALUE klass, int *permanent) https://github.com/ruby/ruby/blob/trunk/variable.c#L176
 		    return Qnil;
 		}
 		if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) {
-		    path = rb_str_dup(rb_id2str(cid));
-		    OBJ_FREEZE(path);
+		    path = rb_id2str(cid);
 		    return path;
 		}
 		*permanent = 0;

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

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