repo.or.cz
/
newlib-cygwin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git]
/
newlib
/
libc
/
string
/
strdup_r.c
blob
14c80f73f18c1b91454adadc626e415f05141da5
1
#include <reent.h>
2
#include <stdlib.h>
3
#include <string.h>
4
5
char
*
6
_strdup_r
(
struct
_reent
*
reent_ptr
,
7
const char
*
str
)
8
{
9
size_t
len
=
strlen
(
str
) +
1
;
10
char
*
copy
=
_malloc_r
(
reent_ptr
,
len
);
11
if
(
copy
)
12
{
13
memcpy
(
copy
,
str
,
len
);
14
}
15
return
copy
;
16
}