fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / string / strdup_r.c
blobef77a58eb9c9c42ecc785e335954618caed29666
1 #include <reent.h>
2 #include <stdlib.h>
3 #include <string.h>
5 char *
6 _DEFUN (_strdup_r, (reent_ptr, str),
7 struct _reent *reent_ptr _AND
8 _CONST char *str)
10 size_t len = strlen (str) + 1;
11 char *copy = _malloc_r (reent_ptr, len);
12 if (copy)
14 memcpy (copy, str, len);
16 return copy;