summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-10-21 12:46:40 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-10-21 12:46:53 +0900
commit5a77e90fe843a2bfbde3df1867f142efb0ffe9fe (patch)
treeb97ed712d758230db231a5156d0a8e692b0592bb /ext/-test-
parent8c2e5bbf58e562ea410b53c2f77e4186d5ca9da3 (diff)
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.
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/memory_view/memory_view.c42
-rw-r--r--ext/-test-/string/coderange.c8
2 files changed, 25 insertions, 25 deletions
diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c
index a59e7b872b4..0ae9f457ac3 100644
--- a/ext/-test-/memory_view/memory_view.c
+++ b/ext/-test-/memory_view/memory_view.c
@@ -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);
diff --git a/ext/-test-/string/coderange.c b/ext/-test-/string/coderange.c
index 1342ce20da2..bc998ca3724 100644
--- a/ext/-test-/string/coderange.c
+++ b/ext/-test-/string/coderange.c
@@ -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);
}