diff options
author | Roland McGrath <roland@gnu.org> | 1996-07-27 09:36:38 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-07-27 09:36:38 +0000 |
commit | 6f2569682835f0ece6da858491f07a8aa53ee0d6 (patch) | |
tree | 897e1a5d1ea3d548c75abc4a831687b67ca2c377 | |
parent | Sat Jul 27 02:58:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> (diff) | |
download | 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.c | 8 |
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) |