summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-21 16:11:55 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-21 16:11:55 (GMT)
commit8eb0c810b228df1f8352c005a7ae882ad4179b4b (patch)
treecf267fa288dbfce9b48a549b7b9b021cdea21be8 /variable.c
parentdf06c2844288bd59cdcc4e5bed225728d0b2adbc (diff)
get rid of inadvertent ID creation
* object.c (rb_mod_const_get, rb_mod_const_defined): ditto. * variable.c (rb_const_missing, rb_mod_const_missing): call const_missing without new ID to get rid of inadvertent ID creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/variable.c b/variable.c
index 816088f..20991db 100644
--- a/variable.c
+++ b/variable.c
@@ -1475,23 +1475,24 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
UNREACHABLE;
}
-NORETURN(static void uninitialized_constant(VALUE, ID));
+NORETURN(static void uninitialized_constant(VALUE, VALUE));
static void
-uninitialized_constant(VALUE klass, ID id)
+uninitialized_constant(VALUE klass, VALUE name)
{
if (klass && rb_class_real(klass) != rb_cObject)
- rb_name_error(id, "uninitialized constant %"PRIsVALUE"::%"PRIsVALUE"",
- rb_class_name(klass),
- QUOTE_ID(id));
+ rb_name_error_str(name, "uninitialized constant %"PRIsVALUE"::% "PRIsVALUE"",
+ rb_class_name(klass), name);
else {
- rb_name_error(id, "uninitialized constant %"PRIsVALUE"", QUOTE_ID(id));
+ rb_name_error_str(name, "uninitialized constant % "PRIsVALUE"", name);
}
}
-static VALUE
-const_missing(VALUE klass, ID id)
+VALUE
+rb_const_missing(VALUE klass, VALUE name)
{
- return rb_funcall(klass, rb_intern("const_missing"), 1, ID2SYM(id));
+ VALUE value = rb_funcallv(klass, rb_intern("const_missing"), 1, &name);
+ rb_vm_inc_const_missing_count();
+ return value;
}
@@ -1535,7 +1536,7 @@ VALUE
rb_mod_const_missing(VALUE klass, VALUE name)
{
rb_vm_pop_cfunc_frame();
- uninitialized_constant(klass, rb_to_id(name));
+ uninitialized_constant(klass, name);
UNREACHABLE;
}
@@ -1876,9 +1877,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
goto retry;
}
- value = const_missing(klass, id);
- rb_vm_inc_const_missing_count();
- return value;
+ return rb_const_missing(klass, ID2SYM(id));
}
VALUE