summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-13 05:44:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-13 05:44:31 +0000
commit0e76c1408517b943a855240489c1afdb502284dc (patch)
tree76858d64cbe95e8a4f4c4ac22fb941852983aefa
parent1474dd064b28e4a813a79342c5523cede60f83c7 (diff)
eval.c: use local variable
* eval.c (make_exception): use local variable for argv[0]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--eval.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index f38f1c250e..c6b6aad8b4 100644
--- a/eval.c
+++ b/eval.c
@@ -600,7 +600,7 @@ rb_f_raise(int argc, VALUE *argv)
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, int isstr)
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, int isstr)
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");
}