summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty/xmalloc.c
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1998-09-06 22:57:45 +0000
committerjdp <jdp@FreeBSD.org>1998-09-06 22:57:45 +0000
commiteffee09f856ecc81feb91290459a2cda49d20287 (patch)
tree5c46ac1ee102130859f788aeb927e8086985cfe7 /contrib/binutils/libiberty/xmalloc.c
parent31cb88078db5bdc51eb451c5a61e31a426fb8ae6 (diff)
downloadFreeBSD-src-effee09f856ecc81feb91290459a2cda49d20287.zip
FreeBSD-src-effee09f856ecc81feb91290459a2cda49d20287.tar.gz
Import GNU binutils-2.9.1. This will break things for a few minutes
until I've made the commits to resolve the conflicts. Submitted by: Doug Rabson <dfr>
Diffstat (limited to 'contrib/binutils/libiberty/xmalloc.c')
-rw-r--r--contrib/binutils/libiberty/xmalloc.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/contrib/binutils/libiberty/xmalloc.c b/contrib/binutils/libiberty/xmalloc.c
index c479b1f..b88105a 100644
--- a/contrib/binutils/libiberty/xmalloc.c
+++ b/contrib/binutils/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);
OpenPOWER on IntegriCloud