From: bernie Date: Thu, 12 Aug 2004 23:35:50 +0000 (+0000) Subject: Replace a handmade loop with memset(). X-Git-Tag: 1.0.0~1106 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e0e6c8a308489f2f9679a6bacb91cd035e1a7445;p=bertos.git Replace a handmade loop with memset(). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@135 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/mware/xmodem.c b/mware/xmodem.c index 2adfb28d..5e296ab3 100755 --- a/mware/xmodem.c +++ b/mware/xmodem.c @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.4 2004/08/12 23:35:50 bernie + * Replace a handmade loop with memset(). + * * Revision 1.3 2004/08/12 23:34:36 bernie * Replace if/else with continue to reduce indentation level. * @@ -35,6 +38,8 @@ #include #include +#include /* for memset() */ + /*! * \name Protocol control codes @@ -404,9 +409,7 @@ bool xmodem_send(KFile *fd) } /* Pad block with 0xFF if it's partially full */ - if (size < XM_BUFSIZE) - for (i = size; i < XM_BUFSIZE; i++) - block_buffer[i] = (char)0xFF; + memset(block_buffer + size, 0xFF, XM_BUFSIZE - size); /* Send block header (STX, blocknr, ~blocknr) */ ser_putchar(XM_STX);