summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-26 09:07:26 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-26 09:07:26 +0000
commit2b49047143d1e10d6dd5d2359dba2d302fa07c66 (patch)
treec8afffebb66d490bb1fd6e031cec6edb2fa487b9 /eval.c
parentebab487fcd7633038b9272ddbe31c268cda15723 (diff)
mark_end_proc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index de3c73e376..c4d2afcea1 100644
--- a/eval.c
+++ b/eval.c
@@ -5232,10 +5232,20 @@ rb_set_end_proc(func, data)
link->next = end_proc_data;
link->func = func;
link->data = data;
- rb_global_variable(&link->data);
end_proc_data = link;
}
+void
+rb_mark_end_proc()
+{
+ struct end_proc_data *link = end_proc_data;
+
+ while (link) {
+ rb_gc_mark(link->data);
+ link = link->next;
+ }
+}
+
static void
call_end_proc(data)
VALUE data;
@@ -5266,17 +5276,15 @@ rb_f_at_exit()
void
rb_exec_end_proc()
{
- struct end_proc_data *link = end_proc_data;
- struct end_proc_data *tmp;
+ struct end_proc_data *link;
int status;
- while (link) {
+ while (end_proc_data) {
+ link = end_proc_data;
+ end_proc_data = link->next;
rb_protect((VALUE(*)())link->func, link->data, &status);
- tmp = link->next;
free(link);
- link = tmp;
}
- end_proc_data = 0;
}
void