From 5a647a3f5fd011f8558c7f9e90cd65e70e73eb40 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 9 Jun 2008 09:25:32 +0000 Subject: * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc. * *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 60bd2e30be..0d612a5e87 100644 --- a/class.c +++ b/class.c @@ -102,9 +102,9 @@ rb_mod_init_copy(VALUE clone, VALUE orig) ID id; RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(orig)); - id = rb_intern("__classpath__"); + CONST_ID(id, "__classpath__"); st_delete(RCLASS_IV_TBL(clone), (st_data_t*)&id, 0); - id = rb_intern("__classid__"); + CONST_ID(id, "__classid__"); st_delete(RCLASS_IV_TBL(clone), (st_data_t*)&id, 0); } if (RCLASS_M_TBL(orig)) { @@ -169,10 +169,12 @@ void rb_singleton_class_attached(VALUE klass, VALUE obj) { if (FL_TEST(klass, FL_SINGLETON)) { + ID attached; if (!RCLASS_IV_TBL(klass)) { RCLASS_IV_TBL(klass) = st_init_numtable(); } - st_insert(RCLASS_IV_TBL(klass), rb_intern("__attached__"), obj); + CONST_ID(attached, "__attached__"); + st_insert(RCLASS_IV_TBL(klass), attached, obj); } } @@ -214,8 +216,10 @@ rb_define_class_id(ID id, VALUE super) VALUE rb_class_inherited(VALUE super, VALUE klass) { + ID inherited; if (!super) super = rb_cObject; - return rb_funcall(super, rb_intern("inherited"), 1, klass); + CONST_ID(inherited, "inherited"); + return rb_funcall(super, inherited, 1, klass); } VALUE -- cgit v1.2.3