зеркало из https://github.com/github/ruby.git
Use rb_intern_const instead of rb_intern in Init functions
``` find . -name \*.o -exec nm {} + |& sed '/Init_.*\.rbimpl_id/!d;s/^.* b //;s/\.[1-9][0-9]*$//;s/\.rbimpl_id$//' | uniq ``` should be empty.
This commit is contained in:
Родитель
8c2e5bbf58
Коммит
5a77e90fe8
2
error.c
2
error.c
|
@ -2817,7 +2817,7 @@ Init_Exception(void)
|
|||
|
||||
warning_categories = rb_hash_new();
|
||||
rb_gc_register_mark_object(warning_categories);
|
||||
rb_hash_aset(warning_categories, ID2SYM(rb_intern("deprecated")), Qtrue);
|
||||
rb_hash_aset(warning_categories, ID2SYM(rb_intern_const("deprecated")), Qtrue);
|
||||
rb_obj_freeze(warning_categories);
|
||||
}
|
||||
|
||||
|
|
|
@ -350,35 +350,35 @@ Init_memory_view(void)
|
|||
rb_define_method(cMDView, "[]", mdview_aref, 1);
|
||||
rb_memory_view_register(cMDView, &mdview_memory_view_entry);
|
||||
|
||||
id_str = rb_intern("__str__");
|
||||
sym_format = ID2SYM(rb_intern("format"));
|
||||
sym_native_size_p = ID2SYM(rb_intern("native_size_p"));
|
||||
sym_offset = ID2SYM(rb_intern("offset"));
|
||||
sym_size = ID2SYM(rb_intern("size"));
|
||||
sym_repeat = ID2SYM(rb_intern("repeat"));
|
||||
sym_obj = ID2SYM(rb_intern("obj"));
|
||||
sym_len = ID2SYM(rb_intern("len"));
|
||||
sym_readonly = ID2SYM(rb_intern("readonly"));
|
||||
sym_format = ID2SYM(rb_intern("format"));
|
||||
sym_item_size = ID2SYM(rb_intern("item_size"));
|
||||
sym_ndim = ID2SYM(rb_intern("ndim"));
|
||||
sym_shape = ID2SYM(rb_intern("shape"));
|
||||
sym_strides = ID2SYM(rb_intern("strides"));
|
||||
sym_sub_offsets = ID2SYM(rb_intern("sub_offsets"));
|
||||
sym_endianness = ID2SYM(rb_intern("endianness"));
|
||||
sym_little_endian = ID2SYM(rb_intern("little_endian"));
|
||||
sym_big_endian = ID2SYM(rb_intern("big_endian"));
|
||||
id_str = rb_intern_const("__str__");
|
||||
sym_format = ID2SYM(rb_intern_const("format"));
|
||||
sym_native_size_p = ID2SYM(rb_intern_const("native_size_p"));
|
||||
sym_offset = ID2SYM(rb_intern_const("offset"));
|
||||
sym_size = ID2SYM(rb_intern_const("size"));
|
||||
sym_repeat = ID2SYM(rb_intern_const("repeat"));
|
||||
sym_obj = ID2SYM(rb_intern_const("obj"));
|
||||
sym_len = ID2SYM(rb_intern_const("len"));
|
||||
sym_readonly = ID2SYM(rb_intern_const("readonly"));
|
||||
sym_format = ID2SYM(rb_intern_const("format"));
|
||||
sym_item_size = ID2SYM(rb_intern_const("item_size"));
|
||||
sym_ndim = ID2SYM(rb_intern_const("ndim"));
|
||||
sym_shape = ID2SYM(rb_intern_const("shape"));
|
||||
sym_strides = ID2SYM(rb_intern_const("strides"));
|
||||
sym_sub_offsets = ID2SYM(rb_intern_const("sub_offsets"));
|
||||
sym_endianness = ID2SYM(rb_intern_const("endianness"));
|
||||
sym_little_endian = ID2SYM(rb_intern_const("little_endian"));
|
||||
sym_big_endian = ID2SYM(rb_intern_const("big_endian"));
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern("NATIVE_ENDIAN"), sym_big_endian);
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern_const("NATIVE_ENDIAN"), sym_big_endian);
|
||||
#else
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern("NATIVE_ENDIAN"), sym_little_endian);
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern_const("NATIVE_ENDIAN"), sym_little_endian);
|
||||
#endif
|
||||
|
||||
#define DEF_ALIGNMENT_CONST(type, TYPE) do { \
|
||||
int alignment; \
|
||||
STRUCT_ALIGNOF(type, alignment); \
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern(#TYPE "_ALIGNMENT"), INT2FIX(alignment)); \
|
||||
rb_const_set(mMemoryViewTestUtils, rb_intern_const(#TYPE "_ALIGNMENT"), INT2FIX(alignment)); \
|
||||
} while(0)
|
||||
|
||||
DEF_ALIGNMENT_CONST(short, SHORT);
|
||||
|
|
|
@ -38,10 +38,10 @@ str_coderange_scan(VALUE str)
|
|||
void
|
||||
Init_string_coderange(VALUE klass)
|
||||
{
|
||||
sym_7bit = ID2SYM(rb_intern("7bit"));
|
||||
sym_valid = ID2SYM(rb_intern("valid"));
|
||||
sym_unknown = ID2SYM(rb_intern("unknown"));
|
||||
sym_broken = ID2SYM(rb_intern("broken"));
|
||||
sym_7bit = ID2SYM(rb_intern_const("7bit"));
|
||||
sym_valid = ID2SYM(rb_intern_const("valid"));
|
||||
sym_unknown = ID2SYM(rb_intern_const("unknown"));
|
||||
sym_broken = ID2SYM(rb_intern_const("broken"));
|
||||
rb_define_method(klass, "coderange", str_coderange, 0);
|
||||
rb_define_method(klass, "coderange_scan", str_coderange_scan, 0);
|
||||
}
|
||||
|
|
|
@ -1247,24 +1247,24 @@ Init_ossl_ts(void)
|
|||
* timestamp server rejects the message imprint algorithm used in the
|
||||
* +Request+
|
||||
*/
|
||||
sBAD_ALG = rb_intern("BAD_ALG");
|
||||
sBAD_ALG = rb_intern_const("BAD_ALG");
|
||||
|
||||
/*
|
||||
* Possible return value for +Response#failure_info+. Indicates that the
|
||||
* timestamp server was not able to process the +Request+ properly.
|
||||
*/
|
||||
sBAD_REQUEST = rb_intern("BAD_REQUEST");
|
||||
sBAD_REQUEST = rb_intern_const("BAD_REQUEST");
|
||||
/*
|
||||
* Possible return value for +Response#failure_info+. Indicates that the
|
||||
* timestamp server was not able to parse certain data in the +Request+.
|
||||
*/
|
||||
sBAD_DATA_FORMAT = rb_intern("BAD_DATA_FORMAT");
|
||||
sBAD_DATA_FORMAT = rb_intern_const("BAD_DATA_FORMAT");
|
||||
|
||||
sTIME_NOT_AVAILABLE = rb_intern("TIME_NOT_AVAILABLE");
|
||||
sUNACCEPTED_POLICY = rb_intern("UNACCEPTED_POLICY");
|
||||
sUNACCEPTED_EXTENSION = rb_intern("UNACCEPTED_EXTENSION");
|
||||
sADD_INFO_NOT_AVAILABLE = rb_intern("ADD_INFO_NOT_AVAILABLE");
|
||||
sSYSTEM_FAILURE = rb_intern("SYSTEM_FAILURE");
|
||||
sTIME_NOT_AVAILABLE = rb_intern_const("TIME_NOT_AVAILABLE");
|
||||
sUNACCEPTED_POLICY = rb_intern_const("UNACCEPTED_POLICY");
|
||||
sUNACCEPTED_EXTENSION = rb_intern_const("UNACCEPTED_EXTENSION");
|
||||
sADD_INFO_NOT_AVAILABLE = rb_intern_const("ADD_INFO_NOT_AVAILABLE");
|
||||
sSYSTEM_FAILURE = rb_intern_const("SYSTEM_FAILURE");
|
||||
|
||||
/* Document-class: OpenSSL::Timestamp
|
||||
* Provides classes and methods to request, create and validate
|
||||
|
@ -1503,11 +1503,11 @@ Init_ossl_ts(void)
|
|||
*
|
||||
*/
|
||||
cTimestampFactory = rb_define_class_under(mTimestamp, "Factory", rb_cObject);
|
||||
rb_attr(cTimestampFactory, rb_intern("allowed_digests"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern("default_policy_id"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern("serial_number"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern("gen_time"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern("additional_certs"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern_const("allowed_digests"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern_const("default_policy_id"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern_const("serial_number"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern_const("gen_time"), 1, 1, 0);
|
||||
rb_attr(cTimestampFactory, rb_intern_const("additional_certs"), 1, 1, 0);
|
||||
rb_define_method(cTimestampFactory, "create_timestamp", ossl_tsfac_create_ts, 3);
|
||||
}
|
||||
|
||||
|
|
|
@ -820,7 +820,7 @@ void
|
|||
Init_cparse(void)
|
||||
{
|
||||
VALUE Racc, Parser;
|
||||
ID id_racc = rb_intern("Racc");
|
||||
ID id_racc = rb_intern_const("Racc");
|
||||
|
||||
if (rb_const_defined(rb_cObject, id_racc)) {
|
||||
Racc = rb_const_get(rb_cObject, id_racc);
|
||||
|
|
|
@ -502,5 +502,5 @@ rb_memory_view_release(rb_memory_view_t* view)
|
|||
void
|
||||
Init_MemoryView(void)
|
||||
{
|
||||
id_memory_view = rb_intern("__memory_view__");
|
||||
id_memory_view = rb_intern_const("__memory_view__");
|
||||
}
|
||||
|
|
2
time.c
2
time.c
|
@ -5686,7 +5686,7 @@ Init_tm(VALUE outer, const char *name)
|
|||
#endif
|
||||
rb_define_method(tm, "initialize", tm_initialize, -1);
|
||||
rb_define_method(tm, "utc", tm_to_time, 0);
|
||||
rb_alias(tm, rb_intern("to_time"), rb_intern("utc"));
|
||||
rb_alias(tm, rb_intern_const("to_time"), rb_intern_const("utc"));
|
||||
rb_define_singleton_method(tm, "from_time", tm_from_time, 1);
|
||||
/* :startdoc:*/
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче