aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-10 20:54:01 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-13 20:47:07 +0900
commitf3b1b645edfc5a8c938da74a5ed44564b9e2fc08 (patch)
tree179e4a63909d91df39894e98728baf92cc1d8765 /error.c
parent0b5268afbcf11c299e11102c366e836ae55cc39f (diff)
downloadruby-f3b1b645edfc5a8c938da74a5ed44564b9e2fc08.tar.gz
Create backtrace location array directly
Diffstat (limited to 'error.c')
-rw-r--r--error.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/error.c b/error.c
index 14114fc93c..b2f6565dfe 100644
--- a/error.c
+++ b/error.c
@@ -292,6 +292,7 @@ warning_write(int argc, VALUE *argv, VALUE buf)
return buf;
}
+VALUE rb_ec_backtrace_location_ary(rb_execution_context_t *ec, long lev, long n);
static VALUE
rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel)
{
@@ -302,14 +303,11 @@ rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel)
if (!NIL_P(ruby_verbose) && argc > 0) {
VALUE str = argv[0];
if (!NIL_P(uplevel)) {
- VALUE args[2];
long lev = NUM2LONG(uplevel);
if (lev < 0) {
rb_raise(rb_eArgError, "negative level (%ld)", lev);
}
- args[0] = LONG2NUM(lev + 1);
- args[1] = INT2FIX(1);
- location = rb_vm_thread_backtrace_locations(2, args, GET_THREAD()->self);
+ location = rb_ec_backtrace_location_ary(ec, lev + 1, 1);
if (!NIL_P(location)) {
location = rb_ary_entry(location, 0);
}