summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 13:07:58 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 13:07:58 +0000
commit9219029d3c0a3b5ceccd7d1606a1fce48d4e012d (patch)
treef3b41a07199058f51737f7463a37ecb4a60b5755 /vm_eval.c
parentc3a13f6cc4e62832b8bc89bc929b1e1683087bb8 (diff)
* vm.c (vm_backtrace_each): now takes an init function to distinguish
an empty stack from out of stack. [ruby-dev:41366] * vm_eval.c (print_backtrace, rb_thread_backtrace): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/vm_eval.c b/vm_eval.c
index d1e6352e03..b854efc965 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -16,7 +16,7 @@ static inline VALUE rb_vm_set_finish_env(rb_thread_t * th);
static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref);
static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
static inline VALUE vm_backtrace(rb_thread_t *th, int lev);
-static int vm_backtrace_each(rb_thread_t *th, int lev, rb_backtrace_iter_func *iter, void *arg);
+static int vm_backtrace_each(rb_thread_t *th, int lev, void (*init)(void *), rb_backtrace_iter_func *iter, void *arg);
static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr);
static VALUE vm_exec(rb_thread_t *th);
static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref);
@@ -1574,9 +1574,7 @@ rb_f_caller(int argc, VALUE *argv)
if (lev < 0)
rb_raise(rb_eArgError, "negative level (%d)", lev);
- ary = vm_backtrace(GET_THREAD(), lev);
- if (NIL_P(ary)) ary = rb_ary_new();
- return ary;
+ return vm_backtrace(GET_THREAD(), lev);
}
static int
@@ -1598,7 +1596,7 @@ print_backtrace(void *arg, VALUE file, int line, VALUE method)
void
rb_backtrace(void)
{
- vm_backtrace_each(GET_THREAD(), -1, print_backtrace, stderr);
+ vm_backtrace_each(GET_THREAD(), -1, NULL, print_backtrace, stderr);
}
VALUE
@@ -1629,7 +1627,7 @@ rb_thread_backtrace(VALUE thval)
int
rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg)
{
- return vm_backtrace_each(GET_THREAD(), -1, iter, arg);
+ return vm_backtrace_each(GET_THREAD(), -1, NULL, iter, arg);
}
/*