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

ruby-changes:32082

From: nobu <ko1@a...>
Date: Fri, 13 Dec 2013 10:36:37 +0900 (JST)
Subject: [ruby-changes:32082] nobu:r44161 (trunk): proc.c: local variable

nobu	2013-12-13 10:36:31 +0900 (Fri, 13 Dec 2013)

  New Revision: 44161

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

  Log:
    proc.c: local variable
    
    * proc.c (method_inspect): use a local variable instead of repeating
      dereferences.

  Modified files:
    trunk/proc.c
Index: proc.c
===================================================================
--- proc.c	(revision 44160)
+++ proc.c	(revision 44161)
@@ -2212,6 +2212,7 @@ method_inspect(VALUE method) https://github.com/ruby/ruby/blob/trunk/proc.c#L2212
     VALUE str;
     const char *s;
     const char *sharp = "#";
+    VALUE mklass;
 
     TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
     str = rb_str_buf_new2("#<");
@@ -2219,11 +2220,12 @@ method_inspect(VALUE method) https://github.com/ruby/ruby/blob/trunk/proc.c#L2220
     rb_str_buf_cat2(str, s);
     rb_str_buf_cat2(str, ": ");
 
-    if (FL_TEST(data->me->klass, FL_SINGLETON)) {
-	VALUE v = rb_ivar_get(data->me->klass, attached);
+    mklass = data->me->klass;
+    if (FL_TEST(mklass, FL_SINGLETON)) {
+	VALUE v = rb_ivar_get(mklass, attached);
 
 	if (data->recv == Qundef) {
-	    rb_str_buf_append(str, rb_inspect(data->me->klass));
+	    rb_str_buf_append(str, rb_inspect(mklass));
 	}
 	else if (data->recv == v) {
 	    rb_str_buf_append(str, rb_inspect(v));
@@ -2239,9 +2241,9 @@ method_inspect(VALUE method) https://github.com/ruby/ruby/blob/trunk/proc.c#L2241
     }
     else {
 	rb_str_buf_append(str, rb_class_name(data->rclass));
-	if (data->rclass != data->me->klass) {
+	if (data->rclass != mklass) {
 	    rb_str_buf_cat2(str, "(");
-	    rb_str_buf_append(str, rb_class_name(data->me->klass));
+	    rb_str_buf_append(str, rb_class_name(mklass));
 	    rb_str_buf_cat2(str, ")");
 	}
     }

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

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