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

ruby-changes:29417

From: nobu <ko1@a...>
Date: Thu, 20 Jun 2013 13:14:25 +0900 (JST)
Subject: [ruby-changes:29417] nobu:r41469 (trunk): error.c: evaluate RARRAY_AREF once

nobu	2013-06-20 13:14:09 +0900 (Thu, 20 Jun 2013)

  New Revision: 41469

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

  Log:
    error.c: evaluate RARRAY_AREF once
    
    * error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
      the first argument of RB_TYPE_P is expanded twice for non-immediate
      types.

  Modified files:
    trunk/ChangeLog
    trunk/error.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41468)
+++ ChangeLog	(revision 41469)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 20 13:14:06 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
+	  the first argument of RB_TYPE_P is expanded twice for non-immediate
+	  types.
+
 Thu Jun 20 08:09:29 2013  Koichi Sasada  <ko1@a...>
 
 	* tool/gcbench.rb: Summary in one line.
Index: error.c
===================================================================
--- error.c	(revision 41468)
+++ error.c	(revision 41469)
@@ -721,7 +721,8 @@ rb_check_backtrace(VALUE bt) https://github.com/ruby/ruby/blob/trunk/error.c#L721
 	    rb_raise(rb_eTypeError, err);
 	}
 	for (i=0;i<RARRAY_LEN(bt);i++) {
-	    if (!RB_TYPE_P(RARRAY_AREF(bt, i), T_STRING)) {
+	    VALUE e = RARRAY_AREF(bt, i);
+	    if (!RB_TYPE_P(e, T_STRING)) {
 		rb_raise(rb_eTypeError, err);
 	    }
 	}

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

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