summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-19 00:10:50 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-19 15:33:15 +0900
commitb3de25dfee5e27cb54a47999bce885b3700d32fb (patch)
treeab660e82848437f55589d3729a5eebf2999a662a /process.c
parent2ae35ad76611b0da21cef4c8444d9ff74368e874 (diff)
Set static IDs to same name variables
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5574
Diffstat (limited to 'process.c')
-rw-r--r--process.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/process.c b/process.c
index 4011aa569f..b2c99c634e 100644
--- a/process.c
+++ b/process.c
@@ -9123,45 +9123,46 @@ InitVM_process(void)
void
Init_process(void)
{
- 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");
+#define define_id(name) id_##name = rb_intern_const(#name)
+ define_id(in);
+ define_id(out);
+ define_id(err);
+ define_id(pid);
+ define_id(uid);
+ define_id(gid);
+ define_id(close);
+ define_id(child);
#ifdef HAVE_SETPGID
- id_pgroup = rb_intern_const("pgroup");
+ define_id(pgroup);
#endif
#ifdef _WIN32
- 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_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");
+ define_id(new_pgroup);
+#endif
+ define_id(unsetenv_others);
+ define_id(chdir);
+ define_id(umask);
+ define_id(close_others);
+ define_id(nanosecond);
+ define_id(microsecond);
+ define_id(millisecond);
+ define_id(second);
+ define_id(float_microsecond);
+ define_id(float_millisecond);
+ define_id(float_second);
+ define_id(GETTIMEOFDAY_BASED_CLOCK_REALTIME);
+ define_id(TIME_BASED_CLOCK_REALTIME);
#ifdef HAVE_TIMES
- 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");
+ define_id(TIMES_BASED_CLOCK_MONOTONIC);
+ define_id(TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID);
#endif
#ifdef RUSAGE_SELF
- id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID");
+ define_id(GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID);
#endif
- id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID");
+ define_id(CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID);
#ifdef __APPLE__
- id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC = rb_intern_const("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC");
+ define_id(MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC);
#endif
- id_hertz = rb_intern_const("hertz");
+ define_id(hertz);
InitVM(process);
}