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

* eval.c (rb_clear_trace_func, rb_thread_stop_timer_thread):

declarations for forward refernces.

* eval.c (rb_longjmp, eval): use local variable.

* eval.c (rb_longjmp): string object not to be optimized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-13 08:23:12 +00:00
parent 8a25f09d6c
commit f5da26fc34
2 changed files with 26 additions and 12 deletions

View file

@ -1,3 +1,12 @@
Mon Aug 13 17:23:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_clear_trace_func, rb_thread_stop_timer_thread):
declarations for forward refernces.
* eval.c (rb_longjmp, eval): use local variable.
* eval.c (rb_longjmp): string object not to be optimized.
Mon Aug 13 13:21:58 2007 Tanaka Akira <akr@fsij.org>
* lib/open-uri.rb: make ftp passive mode to avoid NAT problem.

29
eval.c
View file

@ -105,6 +105,8 @@ ruby_init(void)
ruby_running = 1;
}
extern void rb_clear_trace_func(void);
void *
ruby_options(int argc, char **argv)
{
@ -151,6 +153,8 @@ ruby_finalize(void)
ruby_finalize_1();
}
void rb_thread_stop_timer_thread(void);
int
ruby_cleanup(int ex)
{
@ -645,6 +649,7 @@ static void
rb_longjmp(int tag, VALUE mesg)
{
VALUE at;
VALUE e;
rb_thread_t *th = GET_THREAD();
const char *file;
int line = 0;
@ -655,7 +660,7 @@ rb_longjmp(int tag, VALUE mesg)
}
if (NIL_P(mesg))
mesg = GET_THREAD()->errinfo;
mesg = th->errinfo;
if (NIL_P(mesg)) {
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
}
@ -670,24 +675,23 @@ rb_longjmp(int tag, VALUE mesg)
}
}
if (!NIL_P(mesg)) {
GET_THREAD()->errinfo = mesg;
th->errinfo = mesg;
}
if (RTEST(ruby_debug) && !NIL_P(GET_THREAD()->errinfo)
&& !rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eSystemExit)) {
VALUE e = GET_THREAD()->errinfo;
if (RTEST(ruby_debug) && !NIL_P(e = th->errinfo) &&
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
e = rb_obj_as_string(e);
RB_GC_GUARD(e) = rb_obj_as_string(e);
warn_printf("Exception `%s' at %s:%d - %s\n",
rb_obj_classname(GET_THREAD()->errinfo),
rb_obj_classname(th->errinfo),
file, line, RSTRING_PTR(e));
}
POP_TAG();
if (status == TAG_FATAL && GET_THREAD()->errinfo == exception_error) {
GET_THREAD()->errinfo = mesg;
if (status == TAG_FATAL && th->errinfo == exception_error) {
th->errinfo = mesg;
}
else if (status) {
thread_reset_raised(th);
@ -1713,11 +1717,12 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
if (state) {
if (state == TAG_RAISE) {
VALUE errinfo = th->errinfo;
if (strcmp(file, "(eval)") == 0) {
VALUE mesg, errat;
errat = get_backtrace(GET_THREAD()->errinfo);
mesg = rb_attr_get(GET_THREAD()->errinfo, rb_intern("mesg"));
errat = get_backtrace(errinfo);
mesg = rb_attr_get(errinfo, rb_intern("mesg"));
if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) {
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
rb_str_update(mesg, 0, 0, rb_str_new2(": "));
@ -1726,7 +1731,7 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
RARRAY_PTR(errat)[0] = RARRAY_PTR(backtrace(-2))[0];
}
}
rb_exc_raise(GET_THREAD()->errinfo);
rb_exc_raise(errinfo);
}
JUMP_TAG(state);
}