public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Implement bzero() via memset()
@ 2017-07-05 11:50 Sebastian Huber
0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2017-07-05 11:50 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d736941a5198d43269c57170a4cdb4e87efa3297
commit d736941a5198d43269c57170a4cdb4e87efa3297
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue Jul 4 14:25:28 2017 +0200
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>
Diff:
---
newlib/libc/string/bzero.c | 13 +++++--------
1 file 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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-07-05 11:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-05 11:50 [newlib-cygwin] Implement bzero() via memset() Sebastian Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).