repo.or.cz
/
vde.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
tagging vde-2 version 2.3.2
[vde.git]
/
2.3.2
/
src
/
common
/
strndup.c
blob
cdbeb106bf2a300c6cfd95c8a18ecb1b71f592d0
1
#include <stdlib.h>
2
#include <string.h>
3
4
#include <config.h>
5
#include <vde.h>
6
#include <vdecommon.h>
7
8
char
*
strndup
(
const char
*
s
,
size_t
n
)
9
{
10
char
*
r
=
malloc
(
n
+
1
);
11
if
(
r
){
12
strncpy
(
r
,
s
,
n
);
13
r
[
n
] =
0
;
14
}
15
return
r
;
16
}
17