ruby-changes:4213
From: ko1@a...
Date: Thu, 6 Mar 2008 11:13:09 +0900 (JST)
Subject: [ruby-changes:4213] nobu - Ruby:r15703 (trunk): * sprintf.c (rb_str_format): no need of loop.
nobu 2008-03-06 11:12:31 +0900 (Thu, 06 Mar 2008) New Revision: 15703 Modified files: trunk/ChangeLog trunk/sprintf.c Log: * sprintf.c (rb_str_format): no need of loop. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15703&r2=15702&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sprintf.c?r1=15703&r2=15702&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15702) +++ ChangeLog (revision 15703) @@ -1,3 +1,7 @@ +Thu Mar 6 11:12:29 2008 Nobuyoshi Nakada <nobu@r...> + + * sprintf.c (rb_str_format): no need of loop. + Thu Mar 6 08:30:42 2008 Yukihiro Matsumoto <matz@r...> * object.c (rb_mod_freeze): call rb_class_name() directly. Index: sprintf.c =================================================================== --- sprintf.c (revision 15702) +++ sprintf.c (revision 15703) @@ -802,8 +802,9 @@ 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)); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/