From 1663d347c993debf7ed83e11e291e7a21e14ed03 Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Tue, 27 Aug 2019 14:21:18 +0900 Subject: delete `$` sign from C identifiers They lack portability. See also https://travis-ci.org/shyouhei/ruby/jobs/577164015 --- io.c | 6 +++--- load.c | 6 +++--- process.c | 8 ++++---- re.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/io.c b/io.c index 2f9df89d6a..e0b81fcc3a 100644 --- a/io.c +++ b/io.c @@ -12987,13 +12987,13 @@ rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char * } static VALUE -get_$LAST_READ_LINE(ID _x, VALUE *_y) +get_LAST_READ_LINE(ID _x, VALUE *_y) { return rb_lastline_get(); } static void -set_$LAST_READ_LINE(VALUE val, ID _x, VALUE *_y) +set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y) { rb_lastline_set(val); } @@ -13271,7 +13271,7 @@ Init_IO(void) rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter); rb_define_hooked_variable("$\\", &rb_output_rs, 0, rb_str_setter); - rb_define_virtual_variable("$_", get_$LAST_READ_LINE, set_$LAST_READ_LINE); + rb_define_virtual_variable("$_", get_LAST_READ_LINE, set_LAST_READ_LINE); rb_define_method(rb_cIO, "initialize_copy", rb_io_init_copy, 1); rb_define_method(rb_cIO, "reopen", rb_io_reopen, -1); diff --git a/load.c b/load.c index 3a21f5c0cf..571995daed 100644 --- a/load.c +++ b/load.c @@ -156,7 +156,7 @@ get_loaded_features(void) } static VALUE -get_$LOADED_FEATURES(ID _x, VALUE *_y) +get_LOADED_FEATURES(ID _x, VALUE *_y) { return get_loaded_features(); } @@ -1265,8 +1265,8 @@ Init_load(void) vm->load_path_check_cache = 0; rb_define_singleton_method(vm->load_path, "resolve_feature_path", rb_resolve_feature_path, 1); - rb_define_virtual_variable("$\"", get_$LOADED_FEATURES, 0); - rb_define_virtual_variable("$LOADED_FEATURES", get_$LOADED_FEATURES, 0); + rb_define_virtual_variable("$\"", get_LOADED_FEATURES, 0); + rb_define_virtual_variable("$LOADED_FEATURES", get_LOADED_FEATURES, 0); vm->loaded_features = rb_ary_new(); vm->loaded_features_snapshot = rb_ary_tmp_new(0); vm->loaded_features_index = st_init_numtable(); diff --git a/process.c b/process.c index dad090712c..a21b17125e 100644 --- a/process.c +++ b/process.c @@ -8039,13 +8039,13 @@ rb_clock_getres(int argc, VALUE *argv) } static VALUE -get_$CHILD_STATUS(ID _x, VALUE *_y) +get_CHILD_STATUS(ID _x, VALUE *_y) { return rb_last_status_get(); } static VALUE -get_$PROCESS_ID(ID _x, VALUE *_y) +get_PROCESS_ID(ID _x, VALUE *_y) { return get_pid(); } @@ -8066,8 +8066,8 @@ InitVM_process(void) { #undef rb_intern #define rb_intern(str) rb_intern_const(str) - rb_define_virtual_variable("$?", get_$CHILD_STATUS, 0); - rb_define_virtual_variable("$$", get_$PROCESS_ID, 0); + rb_define_virtual_variable("$?", get_CHILD_STATUS, 0); + rb_define_virtual_variable("$$", get_PROCESS_ID, 0); rb_define_global_function("exec", rb_f_exec, -1); rb_define_global_function("fork", rb_f_fork, 0); rb_define_global_function("exit!", rb_f_exit_bang, -1); diff --git a/re.c b/re.c index f4aad1e044..d5f9a8792e 100644 --- a/re.c +++ b/re.c @@ -3955,7 +3955,7 @@ match_getter(void) } static VALUE -get_$LAST_MATCH_INFO(ID _x, VALUE *_y) +get_LAST_MATCH_INFO(ID _x, VALUE *_y) { return match_getter(); } @@ -4048,7 +4048,7 @@ Init_Regexp(void) onig_set_warn_func(re_warn); onig_set_verb_warn_func(re_warn); - rb_define_virtual_variable("$~", get_$LAST_MATCH_INFO, match_setter); + rb_define_virtual_variable("$~", get_LAST_MATCH_INFO, match_setter); rb_define_virtual_variable("$&", last_match_getter, 0); rb_define_virtual_variable("$`", prematch_getter, 0); rb_define_virtual_variable("$'", postmatch_getter, 0); -- cgit v1.2.3