summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 01:36:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 01:36:31 +0000
commitc6d03509cc209abd01110c8508ac33566fafa5c3 (patch)
tree4d3218c3b4a291195b3fec36f3c46010fba88dd8
parent2e5422a28ca6af5fd592dd88f790f0a9af4b3cb0 (diff)
proc.c: local variable
* proc.c (method_inspect): use a local variable instead of repeating dereferences. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--proc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/proc.c b/proc.c
index f3e38e9..bc8d354 100644
--- a/proc.c
+++ b/proc.c
@@ -2212,6 +2212,7 @@ method_inspect(VALUE method)
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)
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)
}
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, ")");
}
}