source:
trunk/libs/newlib/src/newlib/libc/string/strdup_r.c
Last change on this file was 444, checked in by , 6 years ago | |
---|---|
File size: 281 bytes |
Line | |
---|---|
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 | } |
Note: See TracBrowser
for help on using the repository browser.