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

ruby-changes:38255

From: nobu <ko1@a...>
Date: Fri, 17 Apr 2015 12:26:42 +0900 (JST)
Subject: [ruby-changes:38255] nobu:r50336 (trunk): string.c: expand heap

nobu	2015-04-17 12:26:21 +0900 (Fri, 17 Apr 2015)

  New Revision: 50336

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

  Log:
    string.c: expand heap
    
    * string.c (str_buf_cat): expand the heap buffer at making
      str independent, not only just copying.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 50335)
+++ string.c	(revision 50336)
@@ -2194,7 +2194,7 @@ str_buf_cat(VALUE str, const char *ptr, https://github.com/ruby/ruby/blob/trunk/string.c#L2194
     if (ptr >= sptr && ptr <= sptr + olen) {
         off = ptr - sptr;
     }
-    rb_str_modify(str);
+    rb_str_modify_expand(str, len);
     if (len == 0) return 0;
     if (STR_EMBED_P(str)) {
 	capa = RSTRING_EMBED_LEN_MAX;

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

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