1 #include <stdlib.h>
2 #include <string.h>
3 
4 char *
_strdup_r(struct _reent * reent_ptr,const char * str)5 _strdup_r (struct _reent *reent_ptr,
6         const char   *str)
7 {
8   size_t len = strlen (str) + 1;
9   char *copy = _malloc_r (reent_ptr, len);
10   if (copy)
11     {
12       memcpy (copy, str, len);
13     }
14   return copy;
15 }
16