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

ruby-changes:11553

From: naruse <ko1@a...>
Date: Mon, 13 Apr 2009 11:40:33 +0900 (JST)
Subject: [ruby-changes:11553] Ruby:r23187 (trunk): * sprintf.c (rb_str_format): optimize previous commit.

naruse	2009-04-13 11:40:20 +0900 (Mon, 13 Apr 2009)

  New Revision: 23187

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

  Log:
    * sprintf.c (rb_str_format): optimize previous commit.
      [ruby-list:45954]

  Modified files:
    trunk/ChangeLog
    trunk/sprintf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23186)
+++ ChangeLog	(revision 23187)
@@ -1,3 +1,8 @@
+Mon Apr 13 11:35:55 2009  NARUSE, Yui  <naruse@r...>
+
+	* sprintf.c (rb_str_format): optimize previous commit.
+	  [ruby-list:45954]
+
 Mon Apr 13 10:58:54 2009  NARUSE, Yui  <naruse@r...>
 
 	* sprintf.c (rb_str_format): check encoding compatibility only on
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 23186)
+++ sprintf.c	(revision 23187)
@@ -660,7 +660,8 @@
 		str = rb_obj_as_string(arg);
 		if (OBJ_TAINTED(str)) tainted = 1;
 		len = RSTRING_LEN(str);
-		enc = rb_enc_check(rb_str_substr(result, 0, blen), str);
+		rb_str_set_len(result, blen);
+		enc = rb_enc_check(result, str);
 		if (flags&(FPREC|FWIDTH)) {
 		    slen = rb_enc_strlen(RSTRING_PTR(str),RSTRING_END(str),enc);
 		    if (slen < 0) {

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

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