summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 14:37:51 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 14:37:51 (GMT)
commit2d1578804b769d00be6145ad335a90b7184e50bb (patch)
tree7ea66325604c970ddb287c2a1857333e0402fd16 /vm_backtrace.c
parent1c90afbc1a2865772700f23dc586e16d18adee2b (diff)
vm_backtrace.c: unknown name method
* vm_backtrace.c (location_format): adjust unknown name method results to other functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 9948654..d461f05 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -288,14 +288,18 @@ location_absolute_path_m(VALUE self)
static VALUE
location_format(VALUE file, int lineno, VALUE name)
{
+ VALUE s = rb_enc_sprintf(rb_enc_compatible(file, name), "%s", RSTRING_PTR(file));
if (lineno != 0) {
- return rb_enc_sprintf(rb_enc_compatible(file, name), "%s:%d:in `%s'",
- RSTRING_PTR(file), lineno, RSTRING_PTR(name));
+ rb_str_catf(s, ":%d", lineno);
+ }
+ rb_str_cat_cstr(s, ":in ");
+ if (NIL_P(name)) {
+ rb_str_cat_cstr(s, "unknown method");
}
else {
- return rb_enc_sprintf(rb_enc_compatible(file, name), "%s:in `%s'",
- RSTRING_PTR(file), RSTRING_PTR(name));
+ rb_str_catf(s, "`%s'", RSTRING_PTR(name));
}
+ return s;
}
static VALUE