From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43539 invoked by alias); 5 Jul 2017 11:50:31 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 43475 invoked by uid 10080); 5 Jul 2017 11:50:30 -0000 Date: Wed, 05 Jul 2017 11:50:00 -0000 Message-ID: <20170705115030.43472.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Implement bzero() via memset() X-Act-Checkin: newlib-cygwin X-Git-Author: Sebastian Huber X-Git-Refname: refs/heads/master X-Git-Oldrev: 8a508f301cb9fb7e11f7cc2e3be7ffd42e64c25f X-Git-Newrev: d736941a5198d43269c57170a4cdb4e87efa3297 X-SW-Source: 2017-q3/txt/msg00001.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d736941a5198d43269c57170a4cdb4e87efa3297 commit d736941a5198d43269c57170a4cdb4e87efa3297 Author: Sebastian Huber 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 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 <> requires no supporting OS subroutines. */ -#include +#include -_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); }