summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error.c5
-rw-r--r--eval.c9
-rw-r--r--eval_error.c4
-rw-r--r--process.c5
-rw-r--r--signal.c7
5 files changed, 21 insertions, 9 deletions
diff --git a/error.c b/error.c
index 61ba07c..254cfe1 100644
--- a/error.c
+++ b/error.c
@@ -646,10 +646,12 @@ VALUE rb_mErrno;
static VALUE rb_eNOERROR;
static ID id_new, id_cause, id_message, id_backtrace;
-static ID id_status, id_name, id_args, id_Errno, id_errno, id_i_path;
+static ID id_name, id_args, id_Errno, id_errno, id_i_path;
+extern ID ruby_static_id_status;
#define id_bt idBt
#define id_bt_locations idBt_locations
#define id_mesg idMesg
+#define id_status ruby_static_id_status
#undef rb_exc_new_cstr
@@ -1913,7 +1915,6 @@ Init_Exception(void)
id_cause = rb_intern_const("cause");
id_message = rb_intern_const("message");
id_backtrace = rb_intern_const("backtrace");
- id_status = rb_intern_const("status");
id_name = rb_intern_const("name");
id_args = rb_intern_const("args");
id_Errno = rb_intern_const("Errno");
diff --git a/eval.c b/eval.c
index 3fef29a..faa80ff 100644
--- a/eval.c
+++ b/eval.c
@@ -24,6 +24,10 @@ NORETURN(void rb_raise_jump(VALUE, VALUE));
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
+ID ruby_static_id_signo, ruby_static_id_status;
+#define id_signo ruby_static_id_signo
+#define id_status ruby_static_id_status
+
#define exception_error GET_VM()->special_exceptions[ruby_error_reenter]
#include "eval_error.c"
@@ -218,7 +222,7 @@ ruby_cleanup(volatile int ex)
break;
}
else if (rb_obj_is_kind_of(err, rb_eSignal)) {
- VALUE sig = rb_iv_get(err, "signo");
+ VALUE sig = rb_ivar_get(err, id_signo);
state = NUM2INT(sig);
break;
}
@@ -1711,4 +1715,7 @@ Init_eval(void)
rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
rb_vm_register_special_exception(ruby_error_reenter, rb_eFatal, "exception reentered");
+
+ id_signo = rb_intern_const("signo");
+ id_status = rb_intern_const("status");
}
diff --git a/eval_error.c b/eval_error.c
index 405d738..c32eff1 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -255,7 +255,7 @@ rb_print_inaccessible(VALUE klass, ID id, int scope)
static int
sysexit_status(VALUE err)
{
- VALUE st = rb_iv_get(err, "status");
+ VALUE st = rb_ivar_get(err, id_status);
return NUM2INT(st);
}
@@ -303,7 +303,7 @@ error_handle(int ex)
status = sysexit_status(errinfo);
}
else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
- rb_iv_get(errinfo, "signo") != INT2FIX(SIGSEGV)) {
+ rb_ivar_get(errinfo, id_signo) != INT2FIX(SIGSEGV)) {
/* no message when exiting by signal */
}
else {
diff --git a/process.c b/process.c
index c52e6ac..ea683e7 100644
--- a/process.c
+++ b/process.c
@@ -256,7 +256,7 @@ typedef unsigned LONG_LONG unsigned_clock_t;
#endif
static ID id_in, id_out, id_err, id_pid, id_uid, id_gid;
-static ID id_close, id_child, id_status;
+static ID id_close, id_child;
#ifdef HAVE_SETPGID
static ID id_pgroup;
#endif
@@ -279,6 +279,8 @@ static ID id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID;
static ID id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC;
#endif
static ID id_hertz;
+extern ID ruby_static_id_status;
+#define id_status ruby_static_id_status
/*
* call-seq:
@@ -7820,7 +7822,6 @@ Init_process(void)
id_gid = rb_intern("gid");
id_close = rb_intern("close");
id_child = rb_intern("child");
- id_status = rb_intern("status");
#ifdef HAVE_SETPGID
id_pgroup = rb_intern("pgroup");
#endif
diff --git a/signal.c b/signal.c
index dcce2b2..f64c24c 100644
--- a/signal.c
+++ b/signal.c
@@ -45,6 +45,9 @@
# include "nacl/signal.h"
#endif
+extern ID ruby_static_id_signo;
+#define id_signo ruby_static_id_signo
+
#ifdef NEED_RUBY_ATOMIC_OPS
rb_atomic_t
ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
@@ -326,7 +329,7 @@ esignal_init(int argc, VALUE *argv, VALUE self)
sig = rb_sprintf("SIG%s", signm);
}
rb_call_super(1, &sig);
- rb_iv_set(self, "signo", INT2NUM(signo));
+ rb_ivar_set(self, id_signo, INT2NUM(signo));
return self;
}
@@ -341,7 +344,7 @@ esignal_init(int argc, VALUE *argv, VALUE self)
static VALUE
esignal_signo(VALUE self)
{
- return rb_iv_get(self, "signo");
+ return rb_ivar_get(self, id_signo);
}
/* :nodoc: */