diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-04 14:25:28 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-05 13:49:48 +0200 |
commit | d736941a5198d43269c57170a4cdb4e87efa3297 (patch) | |
tree | 24bfdf9515629c8e2b4b2dc71defc75423920e9a /newlib/libc/string/bzero.c | |
parent | 8a508f301cb9fb7e11f7cc2e3be7ffd42e64c25f (diff) | |
download | newlib-d736941a5198d43269c57170a4cdb4e87efa3297.zip newlib-d736941a5198d43269c57170a4cdb4e87efa3297.tar.gz newlib-d736941a5198d43269c57170a4cdb4e87efa3297.tar.bz2 |
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>
Diffstat (limited to 'newlib/libc/string/bzero.c')
-rw-r--r-- | newlib/libc/string/bzero.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/newlib/libc/string/bzero.c b/newlib/libc/string/bzero.c index dbcae02..e99529a 100644 --- a/newlib/libc/string/bzero.c +++ b/newlib/libc/string/bzero.c @@ -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); } |