From 8a0efa53e44919bcf5ccb1d3353618a82afdf8bc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 17 Feb 2000 19:39:52 +0000 Subject: import newlib-2000-02-17 snapshot --- newlib/libc/stdlib/strdup_r.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 newlib/libc/stdlib/strdup_r.c (limited to 'newlib/libc/stdlib/strdup_r.c') diff --git a/newlib/libc/stdlib/strdup_r.c b/newlib/libc/stdlib/strdup_r.c new file mode 100644 index 000000000..ef77a58eb --- /dev/null +++ b/newlib/libc/stdlib/strdup_r.c @@ -0,0 +1,17 @@ +#include +#include +#include + +char * +_DEFUN (_strdup_r, (reent_ptr, str), + struct _reent *reent_ptr _AND + _CONST char *str) +{ + size_t len = strlen (str) + 1; + char *copy = _malloc_r (reent_ptr, len); + if (copy) + { + memcpy (copy, str, len); + } + return copy; +} -- cgit v1.2.3