summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-23 07:25:52 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-23 07:25:52 +0000
commit2108e55c0b8fd31cec8968868a56876a22f3104c (patch)
tree479ee29eaecd26251ee6c4a783ad9c52db7f541f /gc.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 'gc.c')
-rw-r--r--gc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gc.c b/gc.c
index ebcb4c1556..86f6071a38 100644
--- a/gc.c
+++ b/gc.c
@@ -2777,7 +2777,7 @@ static void
run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
{
long i;
- int status;
+ enum ruby_tag_type state;
volatile struct {
VALUE errinfo;
VALUE objid;
@@ -2795,14 +2795,15 @@ run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
saved.finished = 0;
TH_PUSH_TAG(th);
- status = TH_EXEC_TAG();
- if (status) {
- ++saved.finished; /* skip failed finalizer */
+ if ((state = TH_EXEC_TAG()) == TAG_NONE) {
+ for (i = saved.finished;
+ RESTORE_FINALIZER(), i<RARRAY_LEN(table);
+ saved.finished = ++i) {
+ run_single_final(RARRAY_AREF(table, i), saved.objid);
+ }
}
- for (i = saved.finished;
- RESTORE_FINALIZER(), i<RARRAY_LEN(table);
- saved.finished = ++i) {
- run_single_final(RARRAY_AREF(table, i), saved.objid);
+ else {
+ ++saved.finished; /* skip failed finalizer */
}
TH_POP_TAG();
#undef RESTORE_FINALIZER