summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 04:14:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 04:14:09 +0000
commitc81f8578c8665cc174a23c5c9c153ea8061bc844 (patch)
treeb81d36c83f8dcb5d5afd76463cad838b356925ae /error.c
parenta12c414d7eb6965b6687d06ad1aa2f125af3b885 (diff)
downloadruby-c81f8578c8665cc174a23c5c9c153ea8061bc844.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/error.c b/error.c
index e65e04fc10..eac254ca44 100644
--- a/error.c
+++ b/error.c
@@ -721,7 +721,8 @@ rb_check_backtrace(VALUE bt)
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);
}
}