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 | c1687039ebb6da080ce43dd66a493485ad22aa62 (patch) | |
tree | c4aea4092d27179fa60be5c02eeb5eadcabd20df /libiberty/xmalloc.c | |
parent | 5d54c62870438863320321eb704a13fc4c85953a (diff) | |
download | gdb-c1687039ebb6da080ce43dd66a493485ad22aa62.zip gdb-c1687039ebb6da080ce43dd66a493485ad22aa62.tar.gz gdb-c1687039ebb6da080ce43dd66a493485ad22aa62.tar.bz2 |
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 7b3d8d4..be25c5a 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); |