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

ruby-changes:38959

From: nobu <ko1@a...>
Date: Fri, 26 Jun 2015 17:58:20 +0900 (JST)
Subject: [ruby-changes:38959] nobu:r51040 (trunk): sprintf.c: rb_inspect returns a string

nobu	2015-06-26 17:58:00 +0900 (Fri, 26 Jun 2015)

  New Revision: 51040

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

  Log:
    sprintf.c: rb_inspect returns a string
    
    * sprintf.c (rb_str_format): rb_inspect() always returns a string.
      rb_obj_as_string() has no more effect.

  Modified files:
    trunk/sprintf.c
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 51039)
+++ sprintf.c	(revision 51040)
@@ -707,8 +707,12 @@ rb_str_format(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/sprintf.c#L707
 		VALUE arg = GETARG();
 		long len, slen;
 
-		if (*p == 'p') arg = rb_inspect(arg);
-		str = rb_obj_as_string(arg);
+		if (*p == 'p') {
+		    str = rb_inspect(arg);
+		}
+		else {
+		    str = rb_obj_as_string(arg);
+		}
 		if (OBJ_TAINTED(str)) tainted = 1;
 		len = RSTRING_LEN(str);
 		rb_str_set_len(result, blen);

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

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