repo.or.cz
/
ppn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
update pet for support for recent versions of clang
[ppn.git]
/
strndup.c
blob
5e6a851434c3e093fea3ee1d7bf5eefdcf5889a0
1
#include <string.h>
2
3
char
*
strndup
(
const char
*
s
,
size_t
n
)
4
{
5
char
*
d
= (
char
*)
malloc
(
n
+
1
);
6
memcpy
(
d
,
s
,
n
);
7
d
[
n
] =
'\0'
;
8
return
d
;
9
}