summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-23 07:25:52 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-23 07:25:52 (GMT)
commit2108e55c0b8fd31cec8968868a56876a22f3104c (patch)
tree479ee29eaecd26251ee6c4a783ad9c52db7f541f /load.c
parent1d248f04294bf5916f54168ee28cc42471132c54 (diff)
use "enum ruby_tag_type" and TAG_NONE.
Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/load.c b/load.c
index 7329dd5..d424d4c 100644
--- a/load.c
+++ b/load.c
@@ -579,7 +579,7 @@ const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
static int
rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
{
- int state;
+ enum ruby_tag_type state;
volatile VALUE wrapper = th->top_wrapper;
volatile VALUE self = th->top_self;
#if !defined __GNUC__
@@ -600,7 +600,7 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
TH_PUSH_TAG(th);
state = EXEC_TAG();
- if (state == 0) {
+ if (state == TAG_NONE) {
NODE *node;
const rb_iseq_t *iseq;
@@ -665,19 +665,19 @@ rb_load(VALUE fname, int wrap)
}
void
-rb_load_protect(VALUE fname, int wrap, int *state)
+rb_load_protect(VALUE fname, int wrap, int *pstate)
{
- int status;
+ enum ruby_tag_type state;
volatile VALUE path = 0;
PUSH_TAG();
- if ((status = EXEC_TAG()) == 0) {
+ if ((state = EXEC_TAG()) == TAG_NONE) {
path = file_to_load(fname);
}
POP_TAG();
- if (!status) status = rb_load_internal0(GET_THREAD(), path, wrap);
- if (state)
- *state = status;
+
+ if (state != TAG_NONE) state = rb_load_internal0(GET_THREAD(), path, wrap);
+ if (state != TAG_NONE) *pstate = state;
}
/*
@@ -961,7 +961,7 @@ rb_require_internal(VALUE fname, int safe)
volatile int result = -1;
rb_thread_t *th = GET_THREAD();
volatile VALUE errinfo = th->errinfo;
- int state;
+ enum ruby_tag_type state;
struct {
int safe;
} volatile saved;
@@ -974,7 +974,7 @@ rb_require_internal(VALUE fname, int safe)
TH_PUSH_TAG(th);
saved.safe = rb_safe_level();
- if ((state = EXEC_TAG()) == 0) {
+ if ((state = EXEC_TAG()) == TAG_NONE) {
long handle;
int found;