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

* 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:
nobu 2005-08-14 15:39:39 +00:00
parent 8e5e94d2f3
commit e117437005
3 changed files with 28 additions and 27 deletions

View file

@ -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>
* lib/fileutils.rb (remove_entry_secure): forgot final chdir.

37
eval.c
View file

@ -5361,17 +5361,23 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
int state;
volatile VALUE result;
volatile VALUE e_info = ruby_errinfo;
volatile int handle;
VALUE eclass;
va_list args;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
retry_entry:
switch (state = EXEC_TAG()) {
case TAG_RETRY:
if (!handle) break;
handle = Qfalse;
state = 0;
ruby_errinfo = Qnil;
case 0:
result = (*b_proc)(data1);
}
else if (state == TAG_RAISE) {
int handle = Qfalse;
VALUE eclass;
break;
case TAG_RAISE:
if (handle) break;
handle = Qfalse;
va_init_list(args, data2);
while (eclass = va_arg(args, VALUE)) {
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);
if (handle) {
state = 0;
if (r_proc) {
PUSH_TAG(PROT_NONE);
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;
}
result = (*r_proc)(data2, ruby_errinfo);
}
else {
result = Qnil;
state = 0;
}
if (state == 0) {
ruby_errinfo = e_info;
}
ruby_errinfo = e_info;
}
}
POP_TAG();

11
range.c
View file

@ -29,11 +29,7 @@ static VALUE
range_check(args)
VALUE *args;
{
VALUE v;
v = rb_funcall(args[0], id_cmp, 1, args[1]);
if (NIL_P(v)) range_failed();
return Qnil;
return rb_funcall(args[0], id_cmp, 1, args[1]);
}
static void
@ -47,7 +43,10 @@ range_init(range, beg, end, exclude_end)
args[1] = 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);