1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_protect): restore root_jmpbuf even if proc exits by

break such as dbm.delete_if { break }.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-13 23:19:14 +00:00
parent c958d9a9c6
commit 30c5d612c2
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 14 08:17:24 2007 Tanaka Akira <akr@fsij.org>
* eval.c (rb_protect): restore root_jmpbuf even if proc exits by
break such as dbm.delete_if { break }.
Fri Dec 14 02:55:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (str_nth): direct jump if string is 7bit only. great

6
eval.c
View file

@ -1176,17 +1176,17 @@ rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
struct rb_vm_trap_tag trap_tag;
rb_jmpbuf_t org_jmpbuf;
trap_tag.prev = th->trap_tag;
PUSH_TAG();
th->trap_tag = &trap_tag;
MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1);
if ((status = EXEC_TAG()) == 0) {
rb_jmpbuf_t org_jmpbuf;
MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1);
SAVE_ROOT_JMPBUF(th, result = (*proc) (data));
MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1);
}
MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1);
th->trap_tag = trap_tag.prev;
POP_TAG();