ruby-changes:35868
From: nobu <ko1@a...>
Date: Wed, 15 Oct 2014 23:38:07 +0900 (JST)
Subject: [ruby-changes:35868] nobu:r47950 (trunk): vm_backtrace.c: unknown name method
nobu 2014-10-15 23:37:51 +0900 (Wed, 15 Oct 2014) New Revision: 47950 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47950 Log: vm_backtrace.c: unknown name method * vm_backtrace.c (location_format): adjust unknown name method results to other functions. Modified files: trunk/vm_backtrace.c Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 47949) +++ vm_backtrace.c (revision 47950) @@ -288,14 +288,18 @@ location_absolute_path_m(VALUE self) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L288 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/