summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/malloc_wrapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/malloc_wrapper.cc')
-rw-r--r--winsup/cygwin/malloc_wrapper.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index aa4891b8e..b4babd901 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -74,7 +74,7 @@ _realloc_r (struct _reent *, void *p, size_t size)
extern "C" char *
strdup_dbg (const char *s, const char *file, int line)
{
- char *p;
+ char *p;
export_malloc_called = 1;
if ((p = (char *) malloc_dbg (strlen (s) + 1, file, line)) != NULL)
strcpy (p, s);
@@ -177,6 +177,22 @@ export_calloc (size_t nmemb, size_t size)
return res;
}
+extern "C" char *
+strdup (const char *s)
+{
+ char *p;
+ size_t len = strlen (s) + 1;
+ if ((p = (char *) malloc (len)) != NULL)
+ memcpy (p, s, len);
+ return p;
+}
+
+extern "C" char *
+_strdup_r (struct _reent *, const char *s)
+{
+ return strdup (s);
+}
+
/* We use a critical section to lock access to the malloc data
structures. This permits malloc to be called from different
threads. Note that it does not make malloc reentrant, and it does