[PATCH] Use memcpy() rather than strcpy() in strdup()

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Oct 18 02:15:18 PDT 2006


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).

//Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strdup.c.patch
Type: application/octet-stream
Size: 831 bytes
Desc: strdup.c.patch
Url : http://busybox.net/lists/uclibc/attachments/20061018/0ba0a5b9/attachment.obj 


More information about the uClibc mailing list