Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / strdup_r.c
blob14c80f73f18c1b91454adadc626e415f05141da5
1 #include <reent.h>
2 #include <stdlib.h>
3 #include <string.h>
5 char *
6 _strdup_r (struct _reent *reent_ptr,
7 const char *str)
9 size_t len = strlen (str) + 1;
10 char *copy = _malloc_r (reent_ptr, len);
11 if (copy)
13 memcpy (copy, str, len);
15 return copy;