1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sprintf.c (rb_str_format): optimize previous commit.

[ruby-list:45954]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-04-13 02:40:20 +00:00
parent 87335c3e2f
commit b2ac99dfa3
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 13 11:35:55 2009 NARUSE, Yui <naruse@ruby-lang.org>
* sprintf.c (rb_str_format): optimize previous commit.
[ruby-list:45954]
Mon Apr 13 10:58:54 2009 NARUSE, Yui <naruse@ruby-lang.org>
* sprintf.c (rb_str_format): check encoding compatibility only on

View file

@ -660,7 +660,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
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) {