aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-27 09:36:38 +0000
committerRoland McGrath <roland@gnu.org>1996-07-27 09:36:38 +0000
commit6f2569682835f0ece6da858491f07a8aa53ee0d6 (patch)
tree897e1a5d1ea3d548c75abc4a831687b67ca2c377
parent61965e9b1769700f8f5c32b2e4e20085e76deb09 (diff)
downloadglibc-6f2569682835f0ece6da858491f07a8aa53ee0d6.tar
glibc-6f2569682835f0ece6da858491f07a8aa53ee0d6.tar.gz
glibc-6f2569682835f0ece6da858491f07a8aa53ee0d6.tar.bz2
glibc-6f2569682835f0ece6da858491f07a8aa53ee0d6.zip
Sat Jul 27 04:37:34 1996 Ulrich Drepper <drepper@cygnus.com>
* string/string.h (strndupa): Change to use return value of `memcpy' for more performance. * string/strndup.c: Likewise.
-rw-r--r--string/strndup.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/string/strndup.c b/string/strndup.c
index 8757b869d5..72635bb97c 100644
--- a/string/strndup.c
+++ b/string/strndup.c
@@ -22,7 +22,7 @@ Cambridge, MA 02139, USA. */
char *
-strndup (const char *s, size_t n)
+__strndup (const char *s, size_t n)
{
size_t len = strnlen (s, n);
char *new = malloc (len + 1);
@@ -30,9 +30,7 @@ strndup (const char *s, size_t n)
if (new == NULL)
return NULL;
- memcpy (new, s, len);
new[len] = '\0';
-
- return new;
+ return memcpy (new, s, len);
}
-
+weak_alias (__strndup, strndup)