diff options
author | Mumit Khan <khan@xraylith.wisc.edu> | 1998-01-17 21:30:39 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-01-17 14:30:39 -0700 |
commit | 77aff459558ec67ceafc407420e014433828f7a5 (patch) | |
tree | 3fb1bcc713bf0b50a9443986aa474ff823b51ca8 /libiberty/xmalloc.c | |
parent | 84f79fea91fa299022c62cd3e7a9b42910d974b2 (diff) | |
download | gcc-77aff459558ec67ceafc407420e014433828f7a5.zip gcc-77aff459558ec67ceafc407420e014433828f7a5.tar.gz gcc-77aff459558ec67ceafc407420e014433828f7a5.tar.bz2 |
Add mingw32 support.
* pexecute.c (pexecute): New function for mingw32. Supports pipes.
(pwait): New function for mingw32.
* config.table (i[3456]86-*-mingw32*): Support for i386-mingw32.
* config/mt-mingw32: New file.
* xmalloc.c (first_break): Not used for mingw32.
(xmalloc_set_program_name): Don't use sbrk on mingw32.
(xmalloc): Likewise.
(xrealloc): Likewise.
Co-Authored-By: J.J. VanderHeijden <J.J.vanderHeijden@student.utwente.nl>
From-SVN: r17395
Diffstat (limited to 'libiberty/xmalloc.c')
-rw-r--r-- | libiberty/xmalloc.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index c479b1f..b88105a 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -42,16 +42,22 @@ PTR sbrk PARAMS ((ptrdiff_t)); /* The program name if set. */ static const char *name = ""; -/* The initial sbrk, set when the program name is set. */ +#if ! defined (_WIN32) || defined (__CYGWIN32__) +/* The initial sbrk, set when the program name is set. Not used for win32 + ports other than cygwin32. */ static char *first_break = NULL; +#endif void xmalloc_set_program_name (s) const char *s; { name = s; +#if ! defined (_WIN32) || defined (__CYGWIN32__) + /* Win32 ports other than cygwin32 don't have brk() */ if (first_break == NULL) first_break = (char *) sbrk (0); +#endif /* ! _WIN32 || __CYGWIN32 __ */ } PTR @@ -65,6 +71,7 @@ xmalloc (size) newmem = malloc (size); if (!newmem) { +#if ! defined (_WIN32) || defined (__CYGWIN32__) extern char **environ; size_t allocated; @@ -76,6 +83,12 @@ xmalloc (size) "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* ! _WIN32 || __CYGWIN32 __ */ xexit (1); } return (newmem); @@ -96,6 +109,7 @@ xrealloc (oldmem, size) newmem = realloc (oldmem, size); if (!newmem) { +#ifndef __MINGW32__ extern char **environ; size_t allocated; @@ -107,6 +121,12 @@ xrealloc (oldmem, size) "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not reallocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* __MINGW32__ */ xexit (1); } return (newmem); |