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

View File

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