diff options
author | Ian Lance Taylor <ian@airs.com> | 1999-08-05 21:15:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1999-08-05 21:15:29 +0000 |
commit | 23c6f5255202f1bb33f4b1003eba7072baf3efa5 (patch) | |
tree | f0448cb7de1f711e93ddb4bddfef6533c66a709e /libiberty/xmalloc.c | |
parent | 879a80f8a28fae104fe3d3e0b78a980149df52c1 (diff) | |
download | gdb-23c6f5255202f1bb33f4b1003eba7072baf3efa5.tar.gz |
Revert last patch to xmalloc.c, and instead bring over this patch from
egcs:
Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu>
* configure.in (checkfuncs): Check for sbrk.
* config.in: Rebuilt.
* configure: Likewise.
* xmalloc.c: Use HAVE_SBRK instead of the host specific definitions.
Diffstat (limited to 'libiberty/xmalloc.c')
-rw-r--r-- | libiberty/xmalloc.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index 7b3d8d4bcc9..be25c5aca19 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -1,5 +1,5 @@ /* memory allocation routines with error checking. - Copyright 1989, 90, 91, 92, 93, 94, 1999 Free Software Foundation, Inc. + Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -43,32 +43,22 @@ PTR sbrk PARAMS ((ptrdiff_t)); /* The program name if set. */ static const char *name = ""; -#if !defined (__CYGWIN__) && defined (__CYGWIN32__) -#define __CYGWIN__ 1 -#endif - -/* On Unix systems we use sbrk to determine how much memory has been - allocated. */ -#undef USE_SBRK -#if (! defined (_WIN32) && ! defined (__INTERIX)) || defined (__CYGWIN__) || defined (__UWIN__) -#define USE_SBRK -#endif - -#ifdef USE_SBRK +#ifdef HAVE_SBRK /* The initial sbrk, set when the program name is set. Not used for win32 ports other than cygwin32. */ static char *first_break = NULL; -#endif +#endif /* HAVE_SBRK */ void xmalloc_set_program_name (s) const char *s; { name = s; -#ifdef USE_SBRK +#ifdef HAVE_SBRK + /* Win32 ports other than cygwin32 don't have brk() */ if (first_break == NULL) first_break = (char *) sbrk (0); -#endif +#endif /* HAVE_SBRK */ } PTR @@ -82,7 +72,7 @@ xmalloc (size) newmem = malloc (size); if (!newmem) { -#ifdef USE_SBRK +#ifdef HAVE_SBRK extern char **environ; size_t allocated; @@ -94,12 +84,12 @@ xmalloc (size) "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); -#else +#else /* HAVE_SBRK */ fprintf (stderr, "\n%s%sCan not allocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) size); -#endif /* ! USE_SBRK */ +#endif /* HAVE_SBRK */ xexit (1); } return (newmem); @@ -117,7 +107,7 @@ xcalloc (nelem, elsize) newmem = calloc (nelem, elsize); if (!newmem) { -#ifdef USE_SBRK +#ifdef HAVE_SBRK extern char **environ; size_t allocated; @@ -129,12 +119,12 @@ xcalloc (nelem, elsize) "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) (nelem * elsize), (unsigned long) allocated); -#else +#else /* HAVE_SBRK */ fprintf (stderr, "\n%s%sCan not allocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) (nelem * elsize)); -#endif /* ! USE_SBRK */ +#endif /* HAVE_SBRK */ xexit (1); } return (newmem); @@ -155,7 +145,7 @@ xrealloc (oldmem, size) newmem = realloc (oldmem, size); if (!newmem) { -#ifdef USE_SBRK +#ifdef HAVE_SBRK extern char **environ; size_t allocated; @@ -167,12 +157,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 +#else /* HAVE_SBRK */ fprintf (stderr, "\n%s%sCan not reallocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) size); -#endif /* ! USE_SBRK */ +#endif /* HAVE_SBRK */ xexit (1); } return (newmem); |