aboutsummaryrefslogtreecommitdiff
path: root/gcc/f/malloc.c
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1997-08-27 21:21:05 -0600
committerJeff Law <law@gcc.gnu.org>1997-08-27 21:21:05 -0600
commit795232f720238a9cf7744ee9a0f06f505c28e23b (patch)
tree246ae6f1a287c79231b2663c2ed6742b79ee9c88 /gcc/f/malloc.c
parentd995a6dc4963f6558678d15f0ddade382d6f4bbd (diff)
downloadgcc-795232f720238a9cf7744ee9a0f06f505c28e23b.zip
gcc-795232f720238a9cf7744ee9a0f06f505c28e23b.tar.gz
gcc-795232f720238a9cf7744ee9a0f06f505c28e23b.tar.bz2
Update to Aug 26 g77 front end and runtime.
From-SVN: r14985
Diffstat (limited to 'gcc/f/malloc.c')
-rw-r--r--gcc/f/malloc.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/gcc/f/malloc.c b/gcc/f/malloc.c
index 3b394ea..1cbaf03 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;
}