* environ.cc (getwinenv): Make __stdcall.
(winenv): Ditto. * malloc.cc (strdup): New function. Occludes newlib version. (_strdup_r): Ditto. * winsup.h: Reflect above __stdcall changes.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user