projects
/
fio.git
/ blame_incremental
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blob
|
blame
(non-incremental) |
history
|
HEAD
configure: remember to initialize 'strndup' to "no"
[fio.git]
/
oslib
/
strndup.c
This page requires JavaScript to run. Use
this page
instead.
... / ...
Commit
Line
Data
1
#include <stdlib.h>
2
#include <string.h>
3
4
#ifndef CONFIG_HAVE_STRNDUP
5
6
char *strndup(const char *s, size_t n)
7
{
8
char *str = malloc(n + 1);
9
10
if (str) {
11
strncpy(str, s, n);
12
str[n] = '\0';
13
}
14
15
return str;
16
}
17
18
#endif