Implement bzero() via memset()

Use memset() to implement bzero() to profit from machine-specific
memset() optimizations.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber 2017-07-04 14:25:28 +02:00
parent 8a508f301c
commit d736941a51
1 changed files with 5 additions and 8 deletions

View File

@ -30,14 +30,11 @@ Neither ANSI C nor the System V Interface Definition (Issue 2) require
<<bzero>> requires no supporting OS subroutines.
*/
#include <strings.h>
#include <string.h>
_VOID
_DEFUN (bzero, (b, length),
void *b _AND
size_t length)
void
bzero(void *b, size_t length)
{
char *ptr = (char *)b;
while (length--)
*ptr++ = 0;
memset(b, 0, length);
}