diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-28 03:21:05 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-28 03:21:05 +0000 |
commit | f449a589ba12b67fbabb0567a54c2feb1ded58f6 (patch) | |
tree | 246ae6f1a287c79231b2663c2ed6742b79ee9c88 /gcc/f/malloc.c | |
parent | 92dab6c6e30a4063482220946ec63596380d2cbd (diff) | |
download | gcc-f449a589ba12b67fbabb0567a54c2feb1ded58f6.tar.gz |
Update to Aug 26 g77 front end and runtime.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14985 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/f/malloc.c')
-rw-r--r-- | gcc/f/malloc.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/gcc/f/malloc.c b/gcc/f/malloc.c index 3b394ead563..1cbaf0399ca 100644 --- a/gcc/f/malloc.c +++ b/gcc/f/malloc.c @@ -33,10 +33,9 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "proj.h" #include "malloc.h" -/* For systems where <stdlib.h> is missing: */ - -void *malloc (size_t size); -void *realloc (void *ptr, size_t size); +/* Assume gcc/toplev.o is linked in. */ +void *xmalloc (unsigned size); +void *xrealloc (void *ptr, int size); /* Externals defined here. */ @@ -364,19 +363,14 @@ void * malloc_new_ (mallocSize s) { void *ptr; - size_t ss = s; + unsigned ss = s; -#if MALLOC_DEBUG +#if MALLOC_DEBUG && 0 assert (s == (mallocSize) ss);/* Else alloc is too big for this library/sys. */ #endif - ptr = malloc (ss); - if (ptr == NULL) - { - free (malloc_reserve_); - assert (ptr != NULL); - } + ptr = xmalloc (ss); #if MALLOC_DEBUG memset (ptr, 126, ss); /* Catch some kinds of errors more quickly/reliably. */ @@ -523,18 +517,13 @@ malloc_resize_inpool_ (mallocPool pool, mallocType_ type UNUSED, void * malloc_resize_ (void *ptr, mallocSize s) { - size_t ss = s; + int ss = s; -#if MALLOC_DEBUG +#if MALLOC_DEBUG && 0 assert (s == (mallocSize) ss);/* Too big if failure here. */ #endif - ptr = realloc (ptr, ss); - if (ptr == NULL) - { - free (malloc_reserve_); - assert (ptr != NULL); - } + ptr = xrealloc (ptr, ss); return ptr; } |