From 2b706f3f6e8a185d62ba35696fb717b48972576b Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 21 Feb 2000 03:13:24 +0000 Subject: * environ.cc (getwinenv): Make __stdcall. (winenv): Ditto. * malloc.cc (strdup): New function. Occludes newlib version. (_strdup_r): Ditto. * winsup.h: Reflect above __stdcall changes. --- winsup/cygwin/malloc_wrapper.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/malloc_wrapper.cc') 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 -- cgit v1.2.3