diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-21 03:13:24 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-21 03:13:24 +0000 |
commit | 2b706f3f6e8a185d62ba35696fb717b48972576b (patch) | |
tree | 2fe620f86fd0be3ab4e28293c7c980d3fb66ad05 /winsup/cygwin/malloc_wrapper.cc | |
parent | 351c746ca29747ea5f818a6ad89bd2988ce9badc (diff) | |
download | cygnal-2b706f3f6e8a185d62ba35696fb717b48972576b.tar.gz cygnal-2b706f3f6e8a185d62ba35696fb717b48972576b.tar.bz2 cygnal-2b706f3f6e8a185d62ba35696fb717b48972576b.zip |
* environ.cc (getwinenv): Make __stdcall.
(winenv): Ditto.
* malloc.cc (strdup): New function. Occludes newlib version.
(_strdup_r): Ditto.
* winsup.h: Reflect above __stdcall changes.
Diffstat (limited to 'winsup/cygwin/malloc_wrapper.cc')
-rw-r--r-- | winsup/cygwin/malloc_wrapper.cc | 18 |
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 |