From 8c2e5bbf58e562ea410b53c2f77e4186d5ca9da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Stu=CC=88ben?= Date: Fri, 25 Sep 2020 19:56:30 +0200 Subject: Don't redefine #rb_intern over and over again --- process.c | 64 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 90db3c5677..5ec02f445d 100644 --- a/process.c +++ b/process.c @@ -8441,8 +8441,6 @@ static VALUE rb_mProcID_Syscall; void 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); @@ -8872,46 +8870,46 @@ InitVM_process(void) void Init_process(void) { - id_in = rb_intern("in"); - id_out = rb_intern("out"); - id_err = rb_intern("err"); - id_pid = rb_intern("pid"); - id_uid = rb_intern("uid"); - id_gid = rb_intern("gid"); - id_close = rb_intern("close"); - id_child = rb_intern("child"); + id_in = rb_intern_const("in"); + id_out = rb_intern_const("out"); + id_err = rb_intern_const("err"); + id_pid = rb_intern_const("pid"); + id_uid = rb_intern_const("uid"); + id_gid = rb_intern_const("gid"); + id_close = rb_intern_const("close"); + id_child = rb_intern_const("child"); #ifdef HAVE_SETPGID - id_pgroup = rb_intern("pgroup"); + id_pgroup = rb_intern_const("pgroup"); #endif #ifdef _WIN32 - id_new_pgroup = rb_intern("new_pgroup"); -#endif - id_unsetenv_others = rb_intern("unsetenv_others"); - id_chdir = rb_intern("chdir"); - id_umask = rb_intern("umask"); - id_close_others = rb_intern("close_others"); - id_ENV = rb_intern("ENV"); - id_nanosecond = rb_intern("nanosecond"); - id_microsecond = rb_intern("microsecond"); - id_millisecond = rb_intern("millisecond"); - id_second = rb_intern("second"); - id_float_microsecond = rb_intern("float_microsecond"); - id_float_millisecond = rb_intern("float_millisecond"); - id_float_second = rb_intern("float_second"); - id_GETTIMEOFDAY_BASED_CLOCK_REALTIME = rb_intern("GETTIMEOFDAY_BASED_CLOCK_REALTIME"); - id_TIME_BASED_CLOCK_REALTIME = rb_intern("TIME_BASED_CLOCK_REALTIME"); + id_new_pgroup = rb_intern_const("new_pgroup"); +#endif + id_unsetenv_others = rb_intern_const("unsetenv_others"); + id_chdir = rb_intern_const("chdir"); + id_umask = rb_intern_const("umask"); + id_close_others = rb_intern_const("close_others"); + id_ENV = rb_intern_const("ENV"); + id_nanosecond = rb_intern_const("nanosecond"); + id_microsecond = rb_intern_const("microsecond"); + id_millisecond = rb_intern_const("millisecond"); + id_second = rb_intern_const("second"); + id_float_microsecond = rb_intern_const("float_microsecond"); + id_float_millisecond = rb_intern_const("float_millisecond"); + id_float_second = rb_intern_const("float_second"); + id_GETTIMEOFDAY_BASED_CLOCK_REALTIME = rb_intern_const("GETTIMEOFDAY_BASED_CLOCK_REALTIME"); + id_TIME_BASED_CLOCK_REALTIME = rb_intern_const("TIME_BASED_CLOCK_REALTIME"); #ifdef HAVE_TIMES - id_TIMES_BASED_CLOCK_MONOTONIC = rb_intern("TIMES_BASED_CLOCK_MONOTONIC"); - id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID"); + id_TIMES_BASED_CLOCK_MONOTONIC = rb_intern_const("TIMES_BASED_CLOCK_MONOTONIC"); + id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID"); #endif #ifdef RUSAGE_SELF - id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID"); + id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID"); #endif - id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"); + id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"); #ifdef __APPLE__ - id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC = rb_intern("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC"); + id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC = rb_intern_const("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC"); #endif - id_hertz = rb_intern("hertz"); + id_hertz = rb_intern_const("hertz"); InitVM(process); } -- cgit v1.2.3