* eval.c (rb_rescue2): reduce PUSH_TAG() as well as NODE_RESCUE.
[ruby-dev:26800] * range.c (range_check, range_init): reduce uselse exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e5e94d2f3
commit
e117437005
@ -1,3 +1,10 @@
|
|||||||
|
Mon Aug 15 00:38:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_rescue2): reduce PUSH_TAG() as well as NODE_RESCUE.
|
||||||
|
[ruby-dev:26800]
|
||||||
|
|
||||||
|
* range.c (range_check, range_init): reduce uselse exceptions.
|
||||||
|
|
||||||
Sat Aug 13 22:16:12 2005 Minero Aoki <aamine@loveruby.net>
|
Sat Aug 13 22:16:12 2005 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/fileutils.rb (remove_entry_secure): forgot final chdir.
|
* lib/fileutils.rb (remove_entry_secure): forgot final chdir.
|
||||||
|
37
eval.c
37
eval.c
@ -5361,17 +5361,23 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
|
|||||||
int state;
|
int state;
|
||||||
volatile VALUE result;
|
volatile VALUE result;
|
||||||
volatile VALUE e_info = ruby_errinfo;
|
volatile VALUE e_info = ruby_errinfo;
|
||||||
|
volatile int handle;
|
||||||
|
VALUE eclass;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
switch (state = EXEC_TAG()) {
|
||||||
retry_entry:
|
case TAG_RETRY:
|
||||||
|
if (!handle) break;
|
||||||
|
handle = Qfalse;
|
||||||
|
state = 0;
|
||||||
|
ruby_errinfo = Qnil;
|
||||||
|
case 0:
|
||||||
result = (*b_proc)(data1);
|
result = (*b_proc)(data1);
|
||||||
}
|
break;
|
||||||
else if (state == TAG_RAISE) {
|
case TAG_RAISE:
|
||||||
int handle = Qfalse;
|
if (handle) break;
|
||||||
VALUE eclass;
|
handle = Qfalse;
|
||||||
|
|
||||||
va_init_list(args, data2);
|
va_init_list(args, data2);
|
||||||
while (eclass = va_arg(args, VALUE)) {
|
while (eclass = va_arg(args, VALUE)) {
|
||||||
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
|
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
|
||||||
@ -5382,25 +5388,14 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
|
state = 0;
|
||||||
if (r_proc) {
|
if (r_proc) {
|
||||||
PUSH_TAG(PROT_NONE);
|
result = (*r_proc)(data2, ruby_errinfo);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
|
||||||
result = (*r_proc)(data2, ruby_errinfo);
|
|
||||||
}
|
|
||||||
POP_TAG();
|
|
||||||
if (state == TAG_RETRY) {
|
|
||||||
state = 0;
|
|
||||||
ruby_errinfo = Qnil;
|
|
||||||
goto retry_entry;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = Qnil;
|
result = Qnil;
|
||||||
state = 0;
|
|
||||||
}
|
|
||||||
if (state == 0) {
|
|
||||||
ruby_errinfo = e_info;
|
|
||||||
}
|
}
|
||||||
|
ruby_errinfo = e_info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
11
range.c
11
range.c
@ -29,11 +29,7 @@ static VALUE
|
|||||||
range_check(args)
|
range_check(args)
|
||||||
VALUE *args;
|
VALUE *args;
|
||||||
{
|
{
|
||||||
VALUE v;
|
return rb_funcall(args[0], id_cmp, 1, args[1]);
|
||||||
|
|
||||||
v = rb_funcall(args[0], id_cmp, 1, args[1]);
|
|
||||||
if (NIL_P(v)) range_failed();
|
|
||||||
return Qnil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -47,7 +43,10 @@ range_init(range, beg, end, exclude_end)
|
|||||||
args[1] = end;
|
args[1] = end;
|
||||||
|
|
||||||
if (!FIXNUM_P(beg) || !FIXNUM_P(end)) {
|
if (!FIXNUM_P(beg) || !FIXNUM_P(end)) {
|
||||||
rb_rescue(range_check, (VALUE)args, range_failed, 0);
|
VALUE v;
|
||||||
|
|
||||||
|
v = rb_rescue(range_check, (VALUE)args, range_failed, 0);
|
||||||
|
if (NIL_P(v)) range_failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_EXCL(range, exclude_end);
|
SET_EXCL(range, exclude_end);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user