* eval.c (rb_set_end_proc, rb_exec_end_proc): restore safe level.
[ruby-dev:21557] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
894d8d9e61
commit
582b7e1ca9
@ -1,3 +1,8 @@
|
|||||||
|
Thu Oct 9 14:05:38 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_set_end_proc, rb_exec_end_proc): restore safe level.
|
||||||
|
[ruby-dev:21557]
|
||||||
|
|
||||||
Thu Oct 9 10:51:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Oct 9 10:51:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_yield_0): no error if block is empty.
|
* eval.c (rb_yield_0): no error if block is empty.
|
||||||
|
6
eval.c
6
eval.c
@ -6406,6 +6406,7 @@ NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
|
|||||||
struct end_proc_data {
|
struct end_proc_data {
|
||||||
void (*func)();
|
void (*func)();
|
||||||
VALUE data;
|
VALUE data;
|
||||||
|
int safe;
|
||||||
struct end_proc_data *next;
|
struct end_proc_data *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -6424,6 +6425,7 @@ rb_set_end_proc(func, data)
|
|||||||
link->next = *list;
|
link->next = *list;
|
||||||
link->func = func;
|
link->func = func;
|
||||||
link->data = data;
|
link->data = data;
|
||||||
|
link->safe = ruby_safe_level;
|
||||||
*list = link;
|
*list = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6489,6 +6491,7 @@ rb_exec_end_proc()
|
|||||||
{
|
{
|
||||||
struct end_proc_data *link, *tmp;
|
struct end_proc_data *link, *tmp;
|
||||||
int status;
|
int status;
|
||||||
|
volatile int safe = ruby_safe_level;
|
||||||
|
|
||||||
while (ephemeral_end_procs) {
|
while (ephemeral_end_procs) {
|
||||||
link = ephemeral_end_procs;
|
link = ephemeral_end_procs;
|
||||||
@ -6496,6 +6499,7 @@ rb_exec_end_proc()
|
|||||||
while (link) {
|
while (link) {
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
if ((status = EXEC_TAG()) == 0) {
|
if ((status = EXEC_TAG()) == 0) {
|
||||||
|
ruby_safe_level = link->safe;
|
||||||
(*link->func)(link->data);
|
(*link->func)(link->data);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
@ -6513,6 +6517,7 @@ rb_exec_end_proc()
|
|||||||
while (link) {
|
while (link) {
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
if ((status = EXEC_TAG()) == 0) {
|
if ((status = EXEC_TAG()) == 0) {
|
||||||
|
ruby_safe_level = link->safe;
|
||||||
(*link->func)(link->data);
|
(*link->func)(link->data);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
@ -6524,6 +6529,7 @@ rb_exec_end_proc()
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ruby_safe_level = safe;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user