Sign in
fuchsia
/
fuchsia
/
refs/heads/releases/canary
/
.
/
zircon
/
third_party
/
ulib
/
musl
/
src
/
string
/
strdup.c
blob: c6255813b32dc1234dd737c05a6e8a825b2c509e [
file
] [
log
] [
blame
]
#include
<stdlib.h>
#include
<string.h>
#include
"libc.h"
char
*
strdup
(
const
char
*
s
)
{
size_t
l
=
strlen
(
s
);
char
*
d
=
malloc
(
l
+
1
);
if
(!
d
)
return
NULL
;
return
memcpy
(
d
,
s
,
l
+
1
);
}