summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-26 08:58:00 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-26 08:58:00 (GMT)
commitc47ef3dc13b28334ccbc741b2e125c0cc9f22ad4 (patch)
treea1bc2531fbf256f4986730c04e52215bba81078b /sprintf.c
parent20cecf1d33abfb1cf114b2e313d7de0ce444a0d4 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sprintf.c b/sprintf.c
index 9770a00..4549791 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -707,8 +707,12 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
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);