* 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
This commit is contained in:
nobu 2008-03-06 02:12:31 +00:00
parent bececd35c5
commit 6b10829b22
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Thu Mar 6 11:12:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_str_format): no need of loop.
Thu Mar 6 08:30:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Mar 6 08:30:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_mod_freeze): call rb_class_name() directly. * object.c (rb_mod_freeze): call rb_class_name() directly.

View File

@ -802,8 +802,9 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
blen++; blen++;
need--; need--;
} }
while (need-- > strlen(expr)) { if ((need -= strlen(expr)) > 0) {
buf[blen++] = '0'; memset(buf+blen, '0', need);
blen += need;
} }
strncpy(&buf[blen], expr, strlen(expr)); strncpy(&buf[blen], expr, strlen(expr));
} }