зеркало из https://github.com/github/ruby.git
Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
255adda52f
Коммит
876bfc6b4e
2
class.c
2
class.c
|
@ -539,7 +539,7 @@ Init_class_hierarchy(void)
|
|||
rb_cModule = boot_defclass("Module", rb_cObject);
|
||||
rb_cClass = boot_defclass("Class", rb_cModule);
|
||||
|
||||
rb_const_set(rb_cObject, rb_intern("BasicObject"), rb_cBasicObject);
|
||||
rb_const_set(rb_cObject, rb_intern_const("BasicObject"), rb_cBasicObject);
|
||||
RBASIC_SET_CLASS(rb_cClass, rb_cClass);
|
||||
RBASIC_SET_CLASS(rb_cModule, rb_cClass);
|
||||
RBASIC_SET_CLASS(rb_cObject, rb_cClass);
|
||||
|
|
|
@ -2062,6 +2062,7 @@ InitVM_Enumerator(void)
|
|||
rb_provide("enumerator.so"); /* for backward compatibility */
|
||||
}
|
||||
|
||||
#undef rb_intern
|
||||
void
|
||||
Init_Enumerator(void)
|
||||
{
|
||||
|
|
2
error.c
2
error.c
|
@ -1856,7 +1856,7 @@ Init_Exception(void)
|
|||
|
||||
rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
|
||||
/* the path failed to load */
|
||||
rb_attr(rb_eLoadError, rb_intern("path"), 1, 0, Qfalse);
|
||||
rb_attr(rb_eLoadError, rb_intern_const("path"), 1, 0, Qfalse);
|
||||
|
||||
rb_eNotImpError = rb_define_class("NotImplementedError", rb_eScriptError);
|
||||
|
||||
|
|
1
gc.c
1
gc.c
|
@ -7749,6 +7749,7 @@ rb_gcdebug_sentinel(VALUE obj, const char *name)
|
|||
void
|
||||
Init_GC(void)
|
||||
{
|
||||
#undef rb_intern
|
||||
VALUE rb_mObjSpace;
|
||||
VALUE rb_mProfiler;
|
||||
VALUE gc_constants;
|
||||
|
|
9
random.c
9
random.c
|
@ -1352,7 +1352,7 @@ rb_reset_random_seed(void)
|
|||
*/
|
||||
|
||||
void
|
||||
Init_Random(void)
|
||||
InitVM_Random(void)
|
||||
{
|
||||
Init_RandomSeed2();
|
||||
rb_define_global_function("srand", rb_f_srand, -1);
|
||||
|
@ -1383,7 +1383,14 @@ Init_Random(void)
|
|||
rb_define_singleton_method(rb_cRandom, "new_seed", random_seed, 0);
|
||||
rb_define_private_method(CLASS_OF(rb_cRandom), "state", random_s_state, 0);
|
||||
rb_define_private_method(CLASS_OF(rb_cRandom), "left", random_s_left, 0);
|
||||
}
|
||||
|
||||
#undef rb_intern
|
||||
void
|
||||
Init_Random(void)
|
||||
{
|
||||
id_rand = rb_intern("rand");
|
||||
id_bytes = rb_intern("bytes");
|
||||
|
||||
InitVM(Random);
|
||||
}
|
||||
|
|
2
signal.c
2
signal.c
|
@ -1312,7 +1312,7 @@ Init_signal(void)
|
|||
|
||||
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
|
||||
rb_define_method(rb_eSignal, "signo", esignal_signo, 0);
|
||||
rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
|
||||
rb_alias(rb_eSignal, rb_intern_const("signm"), rb_intern_const("message"));
|
||||
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
|
||||
|
||||
install_sighandler(SIGINT, sighandler);
|
||||
|
|
12
struct.c
12
struct.c
|
@ -1064,7 +1064,7 @@ rb_struct_size(VALUE s)
|
|||
* Symbol (<code>:name</code>).
|
||||
*/
|
||||
void
|
||||
Init_Struct(void)
|
||||
InitVM_Struct(void)
|
||||
{
|
||||
rb_cStruct = rb_define_class("Struct", rb_cObject);
|
||||
rb_include_module(rb_cStruct, rb_mEnumerable);
|
||||
|
@ -1095,5 +1095,13 @@ Init_Struct(void)
|
|||
rb_define_method(rb_cStruct, "values_at", rb_struct_values_at, -1);
|
||||
|
||||
rb_define_method(rb_cStruct, "members", rb_struct_members_m, 0);
|
||||
id_members = rb_intern("__members__");
|
||||
}
|
||||
|
||||
#undef rb_intern
|
||||
void
|
||||
Init_Struct(void)
|
||||
{
|
||||
id_members = rb_intern("__members__");
|
||||
|
||||
InitVM(Struct);
|
||||
}
|
||||
|
|
15
transcode.c
15
transcode.c
|
@ -4388,13 +4388,10 @@ ecerr_incomplete_input(VALUE self)
|
|||
* correspond with a known converter.
|
||||
*/
|
||||
|
||||
#undef rb_intern
|
||||
void
|
||||
Init_transcode(void)
|
||||
{
|
||||
rb_eUndefinedConversionError = rb_define_class_under(rb_cEncoding, "UndefinedConversionError", rb_eEncodingError);
|
||||
rb_eInvalidByteSequenceError = rb_define_class_under(rb_cEncoding, "InvalidByteSequenceError", rb_eEncodingError);
|
||||
rb_eConverterNotFoundError = rb_define_class_under(rb_cEncoding, "ConverterNotFoundError", rb_eEncodingError);
|
||||
|
||||
transcoder_table = st_init_strcasetable();
|
||||
|
||||
sym_invalid = ID2SYM(rb_intern("invalid"));
|
||||
|
@ -4426,6 +4423,16 @@ Init_transcode(void)
|
|||
sym_lf = ID2SYM(rb_intern("lf"));
|
||||
#endif
|
||||
|
||||
InitVM(transcode);
|
||||
}
|
||||
|
||||
void
|
||||
InitVM_transcode(void)
|
||||
{
|
||||
rb_eUndefinedConversionError = rb_define_class_under(rb_cEncoding, "UndefinedConversionError", rb_eEncodingError);
|
||||
rb_eInvalidByteSequenceError = rb_define_class_under(rb_cEncoding, "InvalidByteSequenceError", rb_eEncodingError);
|
||||
rb_eConverterNotFoundError = rb_define_class_under(rb_cEncoding, "ConverterNotFoundError", rb_eEncodingError);
|
||||
|
||||
rb_define_method(rb_cString, "encode", str_encode, -1);
|
||||
rb_define_method(rb_cString, "encode!", str_encode_bang, -1);
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ void
|
|||
Init_var_tables(void)
|
||||
{
|
||||
rb_global_tbl = st_init_numtable();
|
||||
CONST_ID(autoload, "__autoload__");
|
||||
autoload = rb_intern_const("__autoload__");
|
||||
/* __classpath__: fully qualified class path */
|
||||
CONST_ID(classpath, "__classpath__");
|
||||
classpath = rb_intern_const("__classpath__");
|
||||
/* __tmp_classpath__: temporary class path which contains anonymous names */
|
||||
CONST_ID(tmp_classpath, "__tmp_classpath__");
|
||||
tmp_classpath = rb_intern_const("__tmp_classpath__");
|
||||
/* __classid__: name given to class/module under an anonymous namespace */
|
||||
CONST_ID(classid, "__classid__");
|
||||
classid = rb_intern_const("__classid__");
|
||||
}
|
||||
|
||||
struct fc_result {
|
||||
|
|
Загрузка…
Ссылка в новой задаче