[前][次][番号順一覧][スレッド一覧]

ruby-changes:31128

From: nobu <ko1@a...>
Date: Wed, 9 Oct 2013 13:27:44 +0900 (JST)
Subject: [ruby-changes:31128] nobu:r43207 (trunk): vm_backtrace.c: copy without creating prefix string

nobu	2013-10-09 13:27:39 +0900 (Wed, 09 Oct 2013)

  New Revision: 43207

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43207

  Log:
    vm_backtrace.c: copy without creating prefix string
    
    * vm_backtrace.c (rb_profile_frame_full_label): copy from label
      directly, without creating prefix string.

  Modified files:
    trunk/vm_backtrace.c
Index: vm_backtrace.c
===================================================================
--- vm_backtrace.c	(revision 43206)
+++ vm_backtrace.c	(revision 43207)
@@ -1357,8 +1357,8 @@ rb_profile_frame_full_label(VALUE frame) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1357
     else {
 	long label_length = RSTRING_LEN(label);
 	long base_label_length = RSTRING_LEN(base_label);
-	VALUE prefix = rb_str_new(RSTRING_PTR(label), label_length - base_label_length);
+	int prefix_len = rb_long2int(label_length - base_label_length);
 
-	return rb_sprintf("%"PRIsVALUE"%"PRIsVALUE, prefix, qualified_method_name);
+	return rb_sprintf("%.*s%"PRIsVALUE, prefix_len, RSTRING_PTR(label), qualified_method_name);
     }
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]