projects
/
platform
/
upstream
/
glibc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
61965e9
)
Sat Jul 27 04:37:34 1996 Ulrich Drepper <drepper@cygnus.com>
author
Roland McGrath
<roland@gnu.org>
Sat, 27 Jul 1996 09:36:38 +0000
(09:36 +0000)
committer
Roland McGrath
<roland@gnu.org>
Sat, 27 Jul 1996 09:36:38 +0000
(09:36 +0000)
* string/string.h (strndupa): Change to use return value of
`memcpy' for more performance.
* string/strndup.c: Likewise.
string/strndup.c
patch
|
blob
|
history
diff --git
a/string/strndup.c
b/string/strndup.c
index
8757b86
..
72635bb
100644
(file)
--- 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)