diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 02:12:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 02:12:31 +0000 |
commit | 6b10829b22b2919fb8e8cea895c5fb56c3760127 (patch) | |
tree | 480cfd0753a14cad4923e19abdb4ca1909b15368 /sprintf.c | |
parent | bececd35c5e177de014a0faf83da03db119a825c (diff) |
* sprintf.c (rb_str_format): no need of loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -802,8 +802,9 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt) blen++; need--; } - while (need-- > strlen(expr)) { - buf[blen++] = '0'; + if ((need -= strlen(expr)) > 0) { + memset(buf+blen, '0', need); + blen += need; } strncpy(&buf[blen], expr, strlen(expr)); } |