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

ruby-changes:36677

From: nobu <ko1@a...>
Date: Wed, 10 Dec 2014 16:48:52 +0900 (JST)
Subject: [ruby-changes:36677] nobu:r48758 (trunk): string.c: term fill

nobu	2014-12-10 16:48:34 +0900 (Wed, 10 Dec 2014)

  New Revision: 48758

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

  Log:
    string.c: term fill
    
    * string.c (rb_str_plus): fill wchar terminator.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 48757)
+++ string.c	(revision 48758)
@@ -1455,7 +1455,7 @@ rb_str_plus(VALUE str1, VALUE str2) https://github.com/ruby/ruby/blob/trunk/string.c#L1455
     ptr3 = RSTRING_PTR(str3);
     memcpy(ptr3, ptr1, len1);
     memcpy(ptr3+len1, ptr2, len2);
-    ptr3[len1+len2] = '\0';
+    TERM_FILL(&ptr3[len1+len2], rb_enc_mbminlen(enc));
 
     if (OBJ_TAINTED(str1) || OBJ_TAINTED(str2))
 	OBJ_TAINT(str3);

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

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