[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclibc
Subject:    [PATCH] Use memcpy() rather than strcpy() in strdup()
From:       andersen () codepoet ! org (Erik Andersen)
Date:       2006-10-18 17:16:28
Message-ID: 20061018171628.GA11514 () codepoet ! org
[Download RAW message or body]

On Wed Oct 18, 2006 at 11:15:18AM +0200, Peter Kjellerstedt wrote:
> Does anyone have any objections to me applying the attached patch?
> It makes strdup() use memcpy() rather than strcpy() to duplicate
> the string.  The rationale is that we already have the length of
> the string to duplicate (from doing the malloc()), and I believe
> memcpy() should then always be faster than strcpy() (or at least
> as fast).

Seems reasonable and more efficient.  Plus memcpy is more
likely to have an arch optimized implementation.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic