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

ruby-changes:29220

From: nobu <ko1@a...>
Date: Thu, 13 Jun 2013 14:45:32 +0900 (JST)
Subject: [ruby-changes:29220] nobu:r41272 (trunk): eval.c: use local variable

nobu	2013-06-13 14:44:31 +0900 (Thu, 13 Jun 2013)

  New Revision: 41272

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

  Log:
    eval.c: use local variable
    
    * eval.c (make_exception): use local variable for argv[0].

  Modified files:
    trunk/eval.c

Index: eval.c
===================================================================
--- eval.c	(revision 41271)
+++ eval.c	(revision 41272)
@@ -600,7 +600,7 @@ rb_f_raise(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/eval.c#L600
 static VALUE
 make_exception(int argc, VALUE *argv, int isstr)
 {
-    VALUE mesg;
+    VALUE mesg, exc;
     ID exception;
     int n;
 
@@ -609,10 +609,11 @@ make_exception(int argc, VALUE *argv, in https://github.com/ruby/ruby/blob/trunk/eval.c#L609
       case 0:
 	break;
       case 1:
-	if (NIL_P(argv[0]))
+	exc = argv[0];
+	if (NIL_P(exc))
 	    break;
 	if (isstr) {
-	    mesg = rb_check_string_type(argv[0]);
+	    mesg = rb_check_string_type(exc);
 	    if (!NIL_P(mesg)) {
 		mesg = rb_exc_new3(rb_eRuntimeError, mesg);
 		break;
@@ -623,11 +624,12 @@ make_exception(int argc, VALUE *argv, in https://github.com/ruby/ruby/blob/trunk/eval.c#L624
 
       case 2:
       case 3:
+	exc = argv[0];
 	n = 1;
       exception_call:
-	if (argv[0] == sysstack_error) return argv[0];
+	if (exc == sysstack_error) return exc;
 	CONST_ID(exception, "exception");
-	mesg = rb_check_funcall(argv[0], exception, n, argv+1);
+	mesg = rb_check_funcall(exc, exception, n, argv+1);
 	if (mesg == Qundef) {
 	    rb_raise(rb_eTypeError, "exception class/object expected");
 	}

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

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